---
title: "Read Logs"
method: POST
path: "/api/logs/filter"
tags: ["Logs"]
---

# Read Logs

`POST /api/logs/filter`

Query for logs.

## Headers

- `x-prefect-api-version` string

## Request body

- BodyReadLogsLogsFilterPost
  - `offset` integer
  - `logs` LogFilter — Filter logs. Only logs matching all criteria will be returned
    - `operator` 'and_' | 'or_' — Operators for combining filter criteria.
    - `level` LogFilterLevel — Filter by `Log.level`.
      - `ge_` integer — Include logs with a level greater than or equal to this level
      - `le_` integer — Include logs with a level less than or equal to this level
    - `timestamp` LogFilterTimestamp — Filter by `Log.timestamp`.
      - `before_` string, date-time — Only include logs with a timestamp at or before this time
      - `after_` string, date-time — Only include logs with a timestamp at or after this time
    - `flow_run_id` LogFilterFlowRunId — Filter by `Log.flow_run_id`.
      - `any_` string[] — A list of flow run IDs to include
    - `task_run_id` LogFilterTaskRunId — Filter by `Log.task_run_id`.
      - `any_` string[] — A list of task run IDs to include
  - `sort` 'TIMESTAMP_ASC' | 'TIMESTAMP_DESC' — Defines log sorting options.
  - `limit` integer — Defaults to PREFECT_API_DEFAULT_LIMIT if not provided.

## Response `200`

Successful Response

- Log[]
  - `id` string, uuid
  - `created` string, date-time
  - `updated` string, date-time
  - `name` string, required — The logger name.
  - `level` integer, required — The log level.
  - `message` string, required — The log message.
  - `timestamp` string, date-time, required — The log timestamp.
  - `flow_run_id` string, uuid — The flow run ID associated with the log.
  - `task_run_id` string, uuid — The task run ID associated with the log.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/prefecthq/apis/untitled-api-2.md) · [All operations](https://skmtc.dev/prefecthq/apis/untitled-api-2/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/prefecthq/untitled-api-2/revisions/29ba6c4f8837/schema)
