Query Requests
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Content-Type: application/json' \
--data '
{
"filter": {},
"offset": 123,
"limit": 123,
"sort": {},
"isCached": true,
"includeInputs": true,
"isPartOfExperiment": true,
"isScored": true
}
'{
"data": [
{
"request_id": "<string>",
"request_created_at": "<string>",
"request_body": {},
"request_path": "<string>",
"request_user_id": {},
"request_properties": {},
"request_model": {},
"response_id": {},
"response_created_at": {},
"response_body": {},
"response_status": 123,
"response_model": {},
"model_override": {},
"provider": "<string>",
"delay_ms": {},
"time_to_first_token": {},
"total_tokens": {},
"prompt_tokens": {},
"completion_tokens": {},
"reasoning_tokens": {},
"cost": {},
"cache_enabled": true,
"cache_reference_id": {},
"scores": {},
"feedback_rating": {},
"properties": {}
}
],
"error": {}
}Requests
Query Requests
Query and filter requests with advanced filtering and pagination
POST
/
v1
/
request
/
query
Query Requests
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Content-Type: application/json' \
--data '
{
"filter": {},
"offset": 123,
"limit": 123,
"sort": {},
"isCached": true,
"includeInputs": true,
"isPartOfExperiment": true,
"isScored": true
}
'{
"data": [
{
"request_id": "<string>",
"request_created_at": "<string>",
"request_body": {},
"request_path": "<string>",
"request_user_id": {},
"request_properties": {},
"request_model": {},
"response_id": {},
"response_created_at": {},
"response_body": {},
"response_status": 123,
"response_model": {},
"model_override": {},
"provider": "<string>",
"delay_ms": {},
"time_to_first_token": {},
"total_tokens": {},
"prompt_tokens": {},
"completion_tokens": {},
"reasoning_tokens": {},
"cost": {},
"cache_enabled": true,
"cache_reference_id": {},
"scores": {},
"feedback_rating": {},
"properties": {}
}
],
"error": {}
}Query requests from your Helicone account with powerful filtering, sorting, and pagination capabilities. This endpoint uses Postgres as the data source.
For better performance with large datasets, consider using the Clickhouse Query endpoint.
Request Body
Filter criteria for requests. Can be a simple filter object, a complex filter tree with Example complex filter:
left, operator, and right properties, or "all" to return all requests.Supported filter tables:request_response_rmt- Main request/response tablerequest- Request-specific fieldsresponse- Response-specific fieldsfeedback- Feedback dataproperties- Custom propertiesvalues- Request valuessessions_request_response_rmt- Session data
{
"request_response_rmt": {
"request_created_at": {
"gte": "2024-01-01T00:00:00Z"
}
}
}
{
"left": {
"request_response_rmt": {
"model": { "equals": "gpt-4" }
}
},
"operator": "and",
"right": {
"request_response_rmt": {
"request_created_at": {
"gte": "2024-01-01T00:00:00Z"
}
}
}
}
Number of records to skip for pagination.
Maximum number of records to return (max 1000).
Sort order for results. Specify field and direction.Example:
{
"created_at": "desc"
}
Filter for cached requests only.
Include input data in the response.
Filter for requests that are part of an experiment.
Filter for requests that have scores attached.
Response
Array of request objects matching the query criteria.
Show HeliconeRequest object
Show HeliconeRequest object
Unique identifier for the request.
ISO 8601 timestamp of when the request was created.
The request payload sent to the LLM provider.
API endpoint path that was called.
User ID associated with the request (from Helicone-User-Id header).
Custom properties attached to the request.
Model name from the request.
Unique identifier for the response.
ISO 8601 timestamp of when the response was created.
The response payload from the LLM provider.
HTTP status code of the response.
Model name from the response.
Model override specified via Helicone-Model-Override header.
LLM provider (e.g., “OPENAI”, “ANTHROPIC”, “AZURE”).
Latency in milliseconds.
Time to first token in milliseconds (for streaming requests).
Total tokens used (prompt + completion).
Number of tokens in the prompt.
Number of tokens in the completion.
Number of reasoning tokens (for models like o1).
Cost of the request in USD.
Whether caching was enabled for this request.
Cache reference ID if cached.
Scores attached to this request.
Feedback rating (true for positive, false for negative).
Custom properties attached to the request.
Error message if the request failed.
Examples
Basic Query
Query all requests from the last 7 days:cURL
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Authorization: Bearer <HELICONE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"request_response_rmt": {
"request_created_at": {
"gte": "2024-01-01T00:00:00Z"
}
}
},
"limit": 100,
"offset": 0,
"sort": {
"created_at": "desc"
}
}'
Filter by Model
Query all GPT-4 requests:cURL
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Authorization: Bearer <HELICONE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"request_response_rmt": {
"model": {
"equals": "gpt-4"
}
}
},
"limit": 50
}'
Filter by Custom Properties
Query requests with specific custom properties:cURL
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Authorization: Bearer <HELICONE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"request_response_rmt": {
"properties": {
"Environment": {
"equals": "production"
}
}
}
},
"limit": 100
}'
Complex Filter with AND/OR
Query GPT-4 requests in production from the last week:cURL
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Authorization: Bearer <HELICONE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"left": {
"request_response_rmt": {
"model": {
"equals": "gpt-4"
}
}
},
"operator": "and",
"right": {
"left": {
"request_response_rmt": {
"request_created_at": {
"gte": "2024-01-01T00:00:00Z"
}
}
},
"operator": "and",
"right": {
"request_response_rmt": {
"properties": {
"Environment": {
"equals": "production"
}
}
}
}
}
},
"limit": 100,
"sort": {
"created_at": "desc"
}
}'
Pagination
Query requests with pagination:cURL
curl --request POST \
--url https://api.helicone.ai/v1/request/query \
--header 'Authorization: Bearer <HELICONE_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"filter": "all",
"limit": 50,
"offset": 100,
"sort": {
"created_at": "desc"
}
}'
Filter Operators
The following operators are supported for different field types:Text Fields
equals- Exact matchnot-equals- Not equal tolike- Pattern match (case-sensitive)ilike- Pattern match (case-insensitive)contains- Contains substringnot-contains- Does not contain substring
Number Fields
equals- Equal tonot-equals- Not equal togte- Greater than or equal tolte- Less than or equal togt- Greater thanlt- Less than
Timestamp Fields
equals- Exact timestamp matchgte- Greater than or equal tolte- Less than or equal togt- Greater thanlt- Less than
Boolean Fields
equals- True or false
Related Endpoints
Get Request by ID
Retrieve a specific request by its ID
Add Feedback
Add feedback to a request
Add Properties
Add custom properties to a request
Add Scores
Add evaluation scores to a request
⌘I
