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
}
'import requests
url = "https://api.helicone.ai/v1/request/query"
payload = {
"filter": {},
"offset": 123,
"limit": 123,
"sort": {},
"isCached": True,
"includeInputs": True,
"isPartOfExperiment": True,
"isScored": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
filter: {},
offset: 123,
limit: 123,
sort: {},
isCached: true,
includeInputs: true,
isPartOfExperiment: true,
isScored: true
})
};
fetch('https://api.helicone.ai/v1/request/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.helicone.ai/v1/request/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
],
'offset' => 123,
'limit' => 123,
'sort' => [
],
'isCached' => true,
'includeInputs' => true,
'isPartOfExperiment' => true,
'isScored' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.helicone.ai/v1/request/query"
payload := strings.NewReader("{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.helicone.ai/v1/request/query")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helicone.ai/v1/request/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}"
response = http.request(request)
puts response.read_body{
"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
}
'import requests
url = "https://api.helicone.ai/v1/request/query"
payload = {
"filter": {},
"offset": 123,
"limit": 123,
"sort": {},
"isCached": True,
"includeInputs": True,
"isPartOfExperiment": True,
"isScored": True
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
filter: {},
offset: 123,
limit: 123,
sort: {},
isCached: true,
includeInputs: true,
isPartOfExperiment: true,
isScored: true
})
};
fetch('https://api.helicone.ai/v1/request/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.helicone.ai/v1/request/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filter' => [
],
'offset' => 123,
'limit' => 123,
'sort' => [
],
'isCached' => true,
'includeInputs' => true,
'isPartOfExperiment' => true,
'isScored' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.helicone.ai/v1/request/query"
payload := strings.NewReader("{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.helicone.ai/v1/request/query")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helicone.ai/v1/request/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"filter\": {},\n \"offset\": 123,\n \"limit\": 123,\n \"sort\": {},\n \"isCached\": true,\n \"includeInputs\": true,\n \"isPartOfExperiment\": true,\n \"isScored\": true\n}"
response = http.request(request)
puts response.read_body{
"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
RequestFilterNode
required
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
default:"0"
Number of records to skip for pagination.
number
default:"10"
Maximum number of records to return (max 1000).
object
Sort order for results. Specify field and direction.Example:
{
"created_at": "desc"
}
boolean
Filter for cached requests only.
boolean
Include input data in the response.
boolean
Filter for requests that are part of an experiment.
boolean
Filter for requests that have scores attached.
Response
HeliconeRequest[]
Array of request objects matching the query criteria.
Show HeliconeRequest object
Show HeliconeRequest object
string
Unique identifier for the request.
string
ISO 8601 timestamp of when the request was created.
object
The request payload sent to the LLM provider.
string
API endpoint path that was called.
string | null
User ID associated with the request (from Helicone-User-Id header).
object | null
Custom properties attached to the request.
string | null
Model name from the request.
string | null
Unique identifier for the response.
string | null
ISO 8601 timestamp of when the response was created.
object
The response payload from the LLM provider.
number
HTTP status code of the response.
string | null
Model name from the response.
string | null
Model override specified via Helicone-Model-Override header.
string
LLM provider (e.g., “OPENAI”, “ANTHROPIC”, “AZURE”).
number | null
Latency in milliseconds.
number | null
Time to first token in milliseconds (for streaming requests).
number | null
Total tokens used (prompt + completion).
number | null
Number of tokens in the prompt.
number | null
Number of tokens in the completion.
number | null
Number of reasoning tokens (for models like o1).
number | null
Cost of the request in USD.
boolean
Whether caching was enabled for this request.
string | null
Cache reference ID if cached.
object | null
Scores attached to this request.
boolean | null
Feedback rating (true for positive, false for negative).
object
Custom properties attached to the request.
string | null
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
