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
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"success": false,
"message": "Rate limit exceeded. Please retry later."
}Tracking
Search Request Logs
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
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"success": false,
"message": "<string>",
"error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"success": false,
"message": "Rate limit exceeded. Please retry later."
}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_groupfor structured filters andqfor fuzzy prefix search across prompt input and LLM output text. - Search indexing, nested fields, and operator behavior are explained in Search Data Model.
Related
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.
Response
Paginated list of matching request logs.
Paginated search results.
Was this page helpful?

