---
title: "Search the default index"
---

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

# Search the default index

Path: Logbrook API › Default index

`GET /logs`

Returns matching events, newest first by event time.

## Authentication

- `bearerAuth`, http, header `Authorization`

## Query parameters

- `from` (`searchDefaultLogs.query.from`; integer, required) — Inclusive Unix milliseconds
- `to` (`searchDefaultLogs.query.to`; integer, required) — Exclusive Unix milliseconds
- `source` (`searchDefaultLogs.query.source`; string, optional) — Comma-separated sources. Defaults to every source the token can read.
- `service` (`searchDefaultLogs.query.service`; string, optional) — Exact service
- `logger` (`searchDefaultLogs.query.logger`; string, optional) — Exact logger
- `host` (`searchDefaultLogs.query.host`; string, optional) — Exact host
- `message` (`searchDefaultLogs.query.message`; string, optional) — Literal message substring
- `min_level` (`searchDefaultLogs.query.min_level`; integer, optional) — Minimum numeric severity
- `limit` (`searchDefaultLogs.query.limit`; integer, optional) — Page size, 1 to configured maximum
- `cursor` (`searchDefaultLogs.query.cursor`; string, optional) — `next_cursor` from the previous page, at most 1024 bytes. Send it with the same index, range, filters and limit; anything else returns `400`.
  - maxLength 1024
- `filter` (`searchDefaultLogs.query.filter`; unknown, optional) — URL-encoded JSON, at most 4096 bytes decoded. Exact, typed matches on top-level attributes; every condition must match, along with the other filters. Missing and null values never match. Duplicate or unknown members and conflicting conditions return `400`. The request path and query together are limited to 32768 bytes.

## Code samples

### cURL

```bash
curl --request GET \
  --url '<base-url>/logs?from=1794297360000&to=1794297480000' \
  --header 'Authorization: Bearer <token>'
```

### TypeScript

```typescript
const url = '<base-url>/logs?from=1794297360000&to=1794297480000';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
```

### Python

```python
import requests

url = "<base-url>/logs?from=1794297360000&to=1794297480000"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

## Responses

### 200

Successful response

#### Example

```json
{
  "events": [
    {
      "id": "4",
      "source": "checkout",
      "event_time": 1794297423000,
      "received_at": 1794297661649,
      "level": 30,
      "service": "checkout-api",
      "logger": "refunds",
      "host": "web-2",
      "pid": 3920,
      "message": "refund issued",
      "attributes": {
        "orderId": "ord_8f3k4"
      }
    },
    {
      "id": "3",
      "source": "checkout",
      "event_time": 1794297421200,
      "received_at": 1794297661610,
      "level": 50,
      "service": "checkout-api",
      "logger": "payments",
      "host": "web-2",
      "pid": 3920,
      "message": "payment declined",
      "attributes": {
        "orderId": "ord_8f3k4",
        "reason": "insufficient_funds"
      }
    }
  ],
  "next_cursor": "v1.eyJ2IjoxLCJraW5kIjoic2VhcmNoIiwicXVlcnkiOiIzZDQ0YzU1MTY1Njc0MzUxMTI1YjMxZjBhNTI3OGFhZmVjMzAwNjgxY2RlOTEyZDEwMzFhM2MwMDBjNmQzZjk4IiwiaGlnaCI6IjQiLCJ0aW1lIjoiMTc5NDI5NzQyMTIwMCIsImlkIjoiMyJ9"
}
```

- `events` (`searchDefaultLogs.response.200.events`; array<object>, required)
  - `id` (`searchDefaultLogs.response.200.events.id`; string, required)
  - `source` (`searchDefaultLogs.response.200.events.source`; string, required)
  - `event_time` (`searchDefaultLogs.response.200.events.event_time`; integer, required)
  - `received_at` (`searchDefaultLogs.response.200.events.received_at`; integer, required)
  - `level` (`searchDefaultLogs.response.200.events.level`; integer, required)
  - `message` (`searchDefaultLogs.response.200.events.message`; string, required)
  - `attributes` (`searchDefaultLogs.response.200.events.attributes`; object, required)
  - `service` (`searchDefaultLogs.response.200.events.service`; string | null, optional)
  - `logger` (`searchDefaultLogs.response.200.events.logger`; string | null, optional)
  - `host` (`searchDefaultLogs.response.200.events.host`; string | null, optional)
  - `pid` (`searchDefaultLogs.response.200.events.pid`; integer | null, optional)
- `next_cursor` (`searchDefaultLogs.response.200.next_cursor`; string | null, required)

### 400

Invalid input

#### Example

```json
{
  "error": "invalid or excessive half-open time range"
}
```

- `error` (`searchDefaultLogs.response.400.error`; string, required)

### 401

Missing or invalid token

#### Example

```json
{
  "error": "Bearer token required"
}
```

- `error` (`searchDefaultLogs.response.401.error`; string, required)

### 403

Source outside read scope

#### Example

```json
{
  "error": "source outside read scope"
}
```

- `error` (`searchDefaultLogs.response.403.error`; string, required)

### 413

Payload exceeds configured budget

#### Example

```json
{
  "error": "query response exceeds byte budget"
}
```

- `error` (`searchDefaultLogs.response.413.error`; string, required)

### 429

Capacity exhausted; Retry-After: 1

#### Example

```json
{
  "error": "HTTP capacity exhausted"
}
```

- `error` (`searchDefaultLogs.response.429.error`; string, required)

### 503

Storage unavailable

#### Example

```json
{
  "error": "storage unavailable"
}
```

- `error` (`searchDefaultLogs.response.503.error`; string, required)

### 504

Query deadline expired

#### Example

```json
{
  "error": "query deadline exceeded"
}
```

- `error` (`searchDefaultLogs.response.504.error`; string, required)


Source: https://sandrinodm.github.io/logbrook/api/default-index/search/index.md
