---
title: "Runs a saved Query on the traffic log"
method: POST
path: "/apiops/projects/{projectName}/reports/saved-queries/{queryName}/search"
tags: ["ProjectReports"]
---

# Runs a saved Query on the traffic log

`POST /apiops/projects/{projectName}/reports/saved-queries/{queryName}/search`

## Request

- Base URL: `http://167.86.118.166:32080`
- URL: `http://167.86.118.166:32080/apiops/projects/{projectName}/reports/saved-queries/{queryName}/search`
- Auth: none declared
- TypeScript: <https://skmtc.dev/apinizer/apis/apinizer-management-apis/docs/apiops/projects/:projectName/reports/saved-queries/:queryName/search/post.ts> (a function with typed inputs; its response is checked against the schema)

Runs the saved Query (Analytics > Queries) called queryName on the traffic log of the given environment and returns the matching records, newest first by default. The Query is looked up by name inside the project in the path; the search covers the project's API and AI gateway traffic. A Query shared by the whole installation (global) is allowed and still sees only this project's traffic. A personal Query is not available through this API and answers 404 like an unknown name. The records carry the traffic list's columns only; request and response bodies, headers and credentials are never returned. Paged: size defaults to 20, at most 200, and page * size + size must stay within resultWindow (10,000); totalElements is the exact count of matching records, so narrow from/to when it is larger than resultWindow. An unreadable traffic log answers 503, never an empty list.

## Path parameters

- `projectName` string, required
- `queryName` string, required

## Query parameters

- `page` integer
- `size` integer
- `sort` string

## Request body

- ApiOpsSavedQuerySearchRequestDTO
  - `environmentName` string: Name of the environment whose traffic log is searched. Required.
  - `from` string: Range start: ISO-8601 (for example 2026-10-27T08:00:00Z) or Elasticsearch date math (for example now-1h). Default now-24h.
  - `to` string: Range end, same formats as from. Default now.
  - `fields` string[]: Columns to return. Omit for the default set. Allowed: timestamp, apiType, statusCode, apiProxyName, endpoint, httpMethod, remoteAddress, consumer, routingAddress, serverName, serverPort, requestPipelineMs, routingMs, responsePipelineMs, totalMs, requestBytes, responseBytes, source. The default set leaves out consumer. Bodies, headers and credentials are never returned by this endpoint.

## Response `200`

successful operation!

- ApiOpsPagedSavedQueryResponse
  - `status` 'SUCCESS' | 'FAILURE'
  - `items` ApiOpsResponseSavedQueryRow[]
    - `timestamp` string, date-time: When the gateway handled the request (UTC).
    - `apiType` string: API type of the proxy that served the request.
    - `statusCode` integer: HTTP status code returned to the client; 0 when no status was recorded.
    - `apiProxyName` string: Name of the API proxy that served the request.
    - `endpoint` string: Endpoint (method name or path) that was called.
    - `httpMethod` string: HTTP method of the request.
    - `remoteAddress` string: Client address of the request.
    - `consumer` string: Identity the client presented (user name or client key). Returned only when asked for.
    - `routingAddress` string: Backend address the request was routed to.
    - `serverName` string: Gateway host name the request arrived on.
    - `serverPort` integer: Gateway port the request arrived on.
    - `requestPipelineMs` integer: Milliseconds spent in the request pipeline.
    - `routingMs` integer: Milliseconds spent in routing (the backend call).
    - `responsePipelineMs` integer: Milliseconds spent in the response pipeline.
    - `totalMs` integer: Total milliseconds the gateway spent on the request. Omitted when the record has no total time.
    - `requestBytes` integer: Request size in bytes.
    - `responseBytes` integer: Response size in bytes.
    - `source` string: API proxy group the request came through; null for a direct call.
  - `page` integer
  - `size` integer
  - `totalElements` integer
  - `totalPages` integer
  - `sort` string[]
  - `queryName` string: Name of the saved Query that was run.
  - `queryScope` string: PROJECT for a Query of the project in the path, GLOBAL for a Query shared by the whole installation.
  - `totalRelation` string: Records are counted exactly (eq). gte would mean the count is a lower bound.
  - `resultWindow` integer: Deepest page * size + size a search can reach. totalElements above this means the range holds more records than can be paged; narrow from/to to read them.

## Other responses

- `400`: bad request!
- `401`: not authorized for this operation!
- `500`: internal error!

## Changes

- **2026-10-28** `e083046b24cd`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/apinizer/apis/apinizer-management-apis/changes/apiops/projects/:projectName/reports/saved-queries/:queryName/search/post.md)

---

[API](https://skmtc.dev/apinizer/apis/apinizer-management-apis.md) - [All operations](https://skmtc.dev/apinizer/apis/apinizer-management-apis/llms.txt) - [OpenAPI document](https://skmtc.dev/apinizer/apis/apinizer-management-apis/revisions/e083046b24cd?raw)
