Skip to main content
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": {}
}

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/helicone/helicone/llms.txt

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

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
RequestFilterNode
required
Filter criteria for requests. Can be a simple filter object, a complex filter tree with left, operator, and right properties, or "all" to return all requests.Supported filter tables:
  • request_response_rmt - Main request/response table
  • request - Request-specific fields
  • response - Response-specific fields
  • feedback - Feedback data
  • properties - Custom properties
  • values - Request values
  • sessions_request_response_rmt - Session data
Example simple filter:
{
  "request_response_rmt": {
    "request_created_at": {
      "gte": "2024-01-01T00:00:00Z"
    }
  }
}
Example complex filter:
{
  "left": {
    "request_response_rmt": {
      "model": { "equals": "gpt-4" }
    }
  },
  "operator": "and",
  "right": {
    "request_response_rmt": {
      "request_created_at": {
        "gte": "2024-01-01T00:00:00Z"
      }
    }
  }
}
offset
number
default:"0"
Number of records to skip for pagination.
limit
number
default:"10"
Maximum number of records to return (max 1000).
sort
object
Sort order for results. Specify field and direction.Example:
{
  "created_at": "desc"
}
isCached
boolean
Filter for cached requests only.
includeInputs
boolean
Include input data in the response.
isPartOfExperiment
boolean
Filter for requests that are part of an experiment.
isScored
boolean
Filter for requests that have scores attached.

Response

data
HeliconeRequest[]
Array of request objects matching the query criteria.
error
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 match
  • not-equals - Not equal to
  • like - Pattern match (case-sensitive)
  • ilike - Pattern match (case-insensitive)
  • contains - Contains substring
  • not-contains - Does not contain substring

Number Fields

  • equals - Equal to
  • not-equals - Not equal to
  • gte - Greater than or equal to
  • lte - Less than or equal to
  • gt - Greater than
  • lt - Less than

Timestamp Fields

  • equals - Exact timestamp match
  • gte - Greater than or equal to
  • lte - Less than or equal to
  • gt - Greater than
  • lt - Less than

Boolean Fields

  • equals - True or false

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