# Query Logs

`GET /api/v1/logs`

## Description
List workflow execution logs with advanced filtering and cursor-based pagination. Supports filtering by workflow, trigger type, date range, duration, cost, and more.

## Parameters

- **workspaceId** (query) (required) — `string`: The unique identifier of the workspace.

- **workflowIds** (query) — `string`: Comma-separated list of workflow IDs to filter by. Only logs from these workflows will be returned.

- **folderIds** (query) — `string`: Comma-separated list of folder IDs. Returns logs for all workflows within these folders.

- **triggers** (query) — `string`: Comma-separated trigger types to filter by: api, webhook, schedule, manual, chat.

- **level** (query) — `string`: Filter logs by severity level. info for successful executions, error for failed ones.

- **startDate** (query) — `string`: Only return logs after this ISO 8601 timestamp (inclusive).

- **endDate** (query) — `string`: Only return logs before this ISO 8601 timestamp (inclusive).

- **executionId** (query) — `string`: Filter by an exact execution ID. Useful for looking up a specific run.

- **minDurationMs** (query) — `integer`: Only return logs where execution took at least this many milliseconds.

- **maxDurationMs** (query) — `integer`: Only return logs where execution took at most this many milliseconds.

- **minCost** (query) — `number`: Only return logs where execution cost at least this amount in USD.

- **maxCost** (query) — `number`: Only return logs where execution cost at most this amount in USD.

- **model** (query) — `string`: Filter by the AI model used during execution (e.g., gpt-4o, claude-sonnet-4-20250514).

- **details** (query) — `string`: Response detail level. basic returns summary fields only. full includes execution data, trace spans, and outputs.

- **includeTraceSpans** (query) — `boolean`: When true, includes block-level execution trace spans with timing and input/output data.

- **includeFinalOutput** (query) — `boolean`: When true, includes the workflow's final output in each log entry.

- **limit** (query) — `integer`: Maximum number of log entries to return per page.

- **cursor** (query) — `string`: Pagination cursor returned from a previous request's nextCursor field.

- **order** (query) — `string`: Sort order by execution start time. desc returns newest first.

## Responses

### 200 — A paginated list of execution logs matching the filter criteria.

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "description": "Array of log entries for the current page.",
      "items": {
        "type": "object",
        "description": "Summary of a single workflow execution log entry.",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique log entry identifier.",
            "example": "log_7x8y9z0a1b"
          },
          "workflowId": {
            "type": "string",
            "description": "The workflow that was executed.",
            "example": "wf_1a2b3c4d5e"
          },
          "executionId": {
            "type": "string",
            "description": "Unique execution identifier for this run.",
            "example": "exec_9f8e7d6c5b"
          },
          "level": {
            "type": "string",
            "description": "Log severity. info for successful executions, error for failures.",
            "example": "info"
          },
          "trigger": {
            "type": "string",
            "description": "How the execution was triggered (e.g., api, manual, webhook, schedule, chat).",
            "example": "api"
          },
          "startedAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 timestamp when execution started.",
            "example": "2025-06-20T14:15:22Z"
          },
          "endedAt": {
            "type": "string",
            "format": "date-time",
            "description": "ISO 8601 timestamp when execution completed.",
            "example": "2025-06-20T14:15:23Z"
          },
          "totalDurationMs": {
            "type": "integer",
            "description": "Total execution duration in milliseconds.",
            "example": 1250
          },
          "cost": {
            "type": "object",
            "description": "Cost summary for this execution.",
            "properties": {
              "total": {
                "type": "number",
                "description": "Total cost of this execution in USD.",
                "example": 0.0032
              }
            }
          },
          "files": {
            "type": "object",
            "nullable": true,
            "description": "File outputs produced during execution. null if no files were generated.",
            "example": null
          }
        }
      }
    },
    "nextCursor": {
      "type": "string",
      "nullable": true,
      "description": "Cursor for fetching the next page. null when there are no more results."
    },
    "limits": {
      "type": "object",
      "description": "Rate limit and usage information attached to the /api/v1 workflows, logs, and audit logs responses. The Execute Workflow and Get Job Status responses do not include it.",
      "properties": {
        "workflowExecutionRateLimit": {
          "type": "object",
          "description": "Current rate limit status for workflow executions.",
          "properties": {
            "sync": {
              "description": "Rate limit bucket for synchronous executions.",
              "$ref": "#/components/schemas/RateLimitBucket"
            },
            "async": {
              "description": "Rate limit bucket for asynchronous executions.",
              "$ref": "#/components/schemas/RateLimitBucket"
            }
          }
        },
        "usage": {
          "type": "object",
          "description": "Current billing period usage and plan limits.",
          "properties": {
            "currentPeriodCost": {
              "type": "number",
              "description": "Total spend in the current billing period in USD.",
              "example": 1.25
            },
            "limit": {
              "type": "number",
              "description": "Maximum allowed spend for the current billing period in USD.",
              "example": 50
            },
            "plan": {
              "type": "string",
              "description": "Your current subscription plan (e.g., free, pro, team).",
              "example": "pro"
            },
            "isExceeded": {
              "type": "boolean",
              "description": "Whether the usage limit has been exceeded. Executions may be blocked when true.",
              "example": false
            }
          }
        }
      }
    }
  }
}
```

### 400 — Invalid request parameters. Check the details array for specific validation errors.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message describing the validation failure."
    },
    "details": {
      "type": "array",
      "description": "List of specific validation errors with field-level details.",
      "items": {
        "type": "object"
      }
    }
  }
}
```

### 401 — Invalid or missing API key. Ensure the X-API-Key header is set with a valid key.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message."
    }
  }
}
```

### 429 — Rate limit exceeded. Wait for the duration specified in the Retry-After header before retrying.

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string",
      "description": "Human-readable error message with rate limit details."
    }
  }
}
```
