Skip to main content
POST
/
api
/
public
/
v2
/
requests
/
search
curl --request POST \
  --url https://api.promptlayer.com/api/public/v2/requests/search \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <api-key>' \
  --data '
{
  "filter_group": {
    "logic": "AND",
    "filters": [
      {
        "field": "cost",
        "operator": "gte",
        "value": 0.1
      },
      {
        "field": "request_start_time",
        "operator": "after",
        "value": "2025-03-14T00:00:00Z"
      }
    ]
  },
  "sort_by": "cost",
  "sort_order": "desc"
}
'
{
  "success": true,
  "items": [
    {
      "id": 12345,
      "engine": "gpt-4o",
      "provider_type": "openai",
      "input_tokens": 150,
      "output_tokens": 300,
      "price": 0.005,
      "request_start_time": "2025-03-15T10:30:00Z",
      "request_end_time": "2025-03-15T10:30:01Z",
      "latency": 1.234,
      "tags_array": [
        "production"
      ],
      "metadata": [
        {
          "user_id": "customer_123"
        }
      ],
      "scores": [],
      "prompt_name": "support-response"
    }
  ],
  "page": 1,
  "pages": 5,
  "per_page": 25,
  "total": 112,
  "has_next": true,
  "has_prev": false,
  "next_num": 2,
  "prev_num": null
}

Documentation Index

Fetch the complete documentation index at: https://promptlayer-claude-nice-fermi-nop3f.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Search logged requests using structured filters, free-text search, sorting, and pagination. This endpoint is useful for analytics, debugging, data export, and custom dashboards.

Behavior Notes

  • This endpoint is rate limited to 10 requests per minute.
  • Results are capped at 25 items per page.
  • Use filter_group for structured filters and q for fuzzy prefix search across prompt input and LLM output text.
  • Search indexing, nested fields, and operator behavior are explained in Search Data Model.

Authorizations

X-API-KEY
string
header
required

Body

application/json

Search and filter request logs with structured filters, free-text search, sorting, and pagination. Extends RequestLogQuery with pagination and include_prompt_name.

filter_group
StructuredFilterGroup · object

Nested filter group with AND/OR logic. Use this for complex queries.

q
string | null

Free-text search query. Searches across the prompt input and LLM output text using fuzzy prefix matching.

sort_by
enum<string> | null

Field to sort results by. Does not affect aggregated output for /requests/analytics.

Available options:
request_start_time,
input_tokens,
output_tokens,
cost,
latency_ms,
status
sort_order
enum<string> | null

Sort direction. Must be provided together with sort_by.

Available options:
asc,
desc
page
integer | null

Page number for pagination. Defaults to 1.

Required range: x >= 1
per_page
integer | null

Number of results per page. Defaults to 10, maximum 25.

Required range: 1 <= x <= 25
include_prompt_name
boolean | null

When true, includes the prompt template name in each result item. Defaults to false.

Response

Paginated list of matching request logs.

Paginated search results.

success
boolean

Indicates the request was successful.

items
RequestLogSearchResult · object[]

List of matching request log summaries.

page
integer

Current page number.

pages
integer

Total number of pages.

per_page
integer

Number of results per page.

total
integer

Total number of matching results.

has_next
boolean

Whether there are more pages after the current one.

has_prev
boolean

Whether there are pages before the current one.

next_num
integer | null

Next page number, or null if on the last page.

prev_num
integer | null

Previous page number, or null if on the first page.