---
title: "Query logs"
description: "GET /api/v1/logs — search and filter messages with a read key."
canonical_url: "https://docs.logstrace.dev/api-reference/endpoints/query-logs"
---
# Query logs

> GET /api/v1/logs — search and filter messages with a read key.

<badge>

GET

</badge>

`/api/v1/logs`

Requires a key with **Read logs** access. 120 requests per minute per key.

## Query parameters

<field-group>
<field name="q" type="string">

Text the message contains, ≤200 characters. Alias: `body`.

</field>

<field name="level" type="string">

One level or a comma list: `warn,error,fatal`. Aliases like `warning` work.

</field>

<field name="channel" type="string">

One channel or a comma list. Alias: `resource`.

</field>

<field name="data.<path>" type="string">

Exact match on a `data` field, dots for nesting: `data.user.id=42`. Up to 5. Alias: `metadata.<path>`.

</field>

<field name="trace" type="string">

Only messages with this `traceId`.

</field>

<field name="template" type="uuid">

Only messages grouped into this table.

</field>

<field name="from / to" type="ISO 8601">

Time range, with offset: `2026-10-06T00:00:00Z`.

</field>

<field name="limit" type="number">

1–100, default 50.

</field>

<field name="offset / cursor" type="number / string">

Paging. `offset` ≤10,000; prefer `cursor` (from `pagination.nextCursor`) for deep paging.

</field>

<field name="order" type="string">

`desc` (newest first, default) or `asc`.

</field>

<field name="includeTotal" type="boolean">

`true` adds `pagination.total`.

</field>
</field-group>

## Example

<code-group>

```bash [Request]
curl -G https://logstrace.dev/api/v1/logs \
  -H "Authorization: Bearer $LOGSTRACE_READ_KEY" \
  --data-urlencode "level=warn,error" \
  --data-urlencode "channel=checkout" \
  --data-urlencode "data.plan=pro" \
  --data-urlencode "limit=5" \
  --data-urlencode "includeTotal=true"
```

```json [200]
{
  "status": "ok",
  "masked": true,
  "data": [
    {
      "id": 191,
      "timestamp": "2026-10-06T09:12:00.000Z",
      "level": "warn",
      "body": "Checkout 7001 failed for user 42",
      "channel": "checkout",
      "traceId": "tr-abc-1",
      "spanId": null,
      "templateId": "8d1f…",
      "metadata": { "plan": "pro", "email": "••••" }
    }
  ],
  "pagination": { "limit": 5, "offset": 0, "hasMore": false, "nextCursor": null, "total": 1 }
}
```

```json [403]
{ "statusCode": 403, "statusMessage": "\"user.email\" is hidden for your role, so it can't be filtered on." }
```

</code-group>

## Masking

Results are [masked](https://docs.logstrace.dev/guides/teams/masking) unless the key was created with **Show IPs, emails and tokens**. `masked` in the response tells you which. A masked key can't filter on hidden `data` fields (`email`, `ip`, `token`…).


## Sitemap

See the full [sitemap](https://docs.logstrace.dev/sitemap.md) for all pages.
