Get Request by ID
curl --request GET \
--url https://api.helicone.ai/v1/request/{requestId}import requests
url = "https://api.helicone.ai/v1/request/{requestId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.helicone.ai/v1/request/{requestId}', 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/{requestId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.helicone.ai/v1/request/{requestId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.helicone.ai/v1/request/{requestId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helicone.ai/v1/request/{requestId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
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": {},
"helicone_user": {},
"provider": "<string>",
"delay_ms": {},
"time_to_first_token": {},
"total_tokens": {},
"prompt_tokens": {},
"completion_tokens": {},
"reasoning_tokens": {},
"prompt_cache_write_tokens": {},
"prompt_cache_read_tokens": {},
"prompt_audio_tokens": {},
"completion_audio_tokens": {},
"cost": {},
"costUSD": {},
"prompt_id": {},
"prompt_version": {},
"feedback_created_at": {},
"feedback_id": {},
"feedback_rating": {},
"signed_body_url": {},
"llmSchema": {},
"country_code": {},
"asset_ids": {},
"asset_urls": {},
"scores": {},
"properties": {},
"assets": [
"<string>"
],
"target_url": "<string>",
"model": "<string>",
"cache_reference_id": {},
"cache_enabled": true,
"updated_at": "<string>",
"request_referrer": {},
"storage_location": "<string>"
},
"error": {}
}Requests
Get Request by ID
Retrieve a specific request by its ID
GET
/
v1
/
request
/
{requestId}
Get Request by ID
curl --request GET \
--url https://api.helicone.ai/v1/request/{requestId}import requests
url = "https://api.helicone.ai/v1/request/{requestId}"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.helicone.ai/v1/request/{requestId}', 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/{requestId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.helicone.ai/v1/request/{requestId}"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.helicone.ai/v1/request/{requestId}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.helicone.ai/v1/request/{requestId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
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": {},
"helicone_user": {},
"provider": "<string>",
"delay_ms": {},
"time_to_first_token": {},
"total_tokens": {},
"prompt_tokens": {},
"completion_tokens": {},
"reasoning_tokens": {},
"prompt_cache_write_tokens": {},
"prompt_cache_read_tokens": {},
"prompt_audio_tokens": {},
"completion_audio_tokens": {},
"cost": {},
"costUSD": {},
"prompt_id": {},
"prompt_version": {},
"feedback_created_at": {},
"feedback_id": {},
"feedback_rating": {},
"signed_body_url": {},
"llmSchema": {},
"country_code": {},
"asset_ids": {},
"asset_urls": {},
"scores": {},
"properties": {},
"assets": [
"<string>"
],
"target_url": "<string>",
"model": "<string>",
"cache_reference_id": {},
"cache_enabled": true,
"updated_at": "<string>",
"request_referrer": {},
"storage_location": "<string>"
},
"error": {}
}Retrieve detailed information about a specific request using its unique identifier. This endpoint returns the full request and response data, including metadata, tokens, costs, and custom properties.
Path Parameters
string
required
The unique identifier of the request to retrieve. This can be found in the
Helicone-Id response header when making requests through Helicone, or in the request_id field when querying requests.Example: req_abc123def456Query Parameters
boolean
default:"false"
Whether to include the full request and response bodies in the result.
true- Returns full request/response bodies (may be large)false- Returns metadata only, with signed URLs for accessing bodies
Setting this to
true may significantly increase response size for requests with large payloads.Response
HeliconeRequest
The request object with full details.
Show HeliconeRequest object
Show HeliconeRequest object
string
Unique identifier for the request.
string
ISO 8601 timestamp of when the request was created.Example:
"2024-01-15T14:30:00.000Z"object
The request payload sent to the LLM provider. Only included when
includeBody=true.string
API endpoint path that was called.Example:
"/v1/chat/completions"string | null
User ID associated with the request (from Helicone-User-Id header).
object | null
Custom properties attached to the request via Helicone-Property-* headers.Example:
{
"Environment": "production",
"Conversation": "support_123",
"App": "mobile"
}
string | null
Model name from the request.Example:
"gpt-4"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. Only included when
includeBody=true.number
HTTP status code of the response.Example:
200, 400, 500string | null
Model name from the response (may differ from request_model).
string | null
Model override specified via Helicone-Model-Override header.
string | null
User identifier from Helicone-User-Id header.
string
LLM provider name.Examples:
"OPENAI", "ANTHROPIC", "AZURE", "GOOGLE", "TOGETHER_AI"number | null
Total latency in milliseconds from request to response completion.
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/input.
number | null
Number of tokens in the completion/output.
number | null
Number of reasoning tokens (for reasoning models like o1).
number | null
Number of tokens written to prompt cache.
number | null
Number of tokens read from prompt cache.
number | null
Number of audio tokens in the prompt (for multimodal models).
number | null
Number of audio tokens in the completion (for multimodal models).
number | null
Cost of the request in USD.
number | null
Alternative field for cost in USD.
string | null
Prompt ID from Helicone-Prompt-Id header.
string | null
Prompt version identifier.
string | null
Timestamp when feedback was added to this request.
string | null
Unique identifier for the feedback.
boolean | null
Feedback rating (true for positive, false for negative).
string | null
Presigned URL to download the full request/response body (when
includeBody=false).object | null
Normalized LLM schema containing structured request and response data.
string | null
Country code of the request origin.
string[] | null
Array of asset IDs associated with this request.
object | null
Map of asset IDs to their URLs.
object | null
Evaluation scores attached to this request.Example:
{
"accuracy": 95,
"relevance": 87,
"helpfulness": 92
}
object
Custom properties attached to the request.
string[]
Array of asset identifiers.
string
The target URL that was proxied to.
string
The model used for this request.
string | null
Cache reference ID if this request was cached.
boolean
Whether caching was enabled for this request.
string
ISO 8601 timestamp of when the request was last updated.
string | null
Referrer information from the request.
string
Storage location identifier for the request data.
string | null
Error message if the request failed.
Examples
Get Request Metadata Only
Retrieve request metadata without the full body:cURL
curl --request GET \
--url https://api.helicone.ai/v1/request/req_abc123def456 \
--header 'Authorization: Bearer <HELICONE_API_KEY>'
TypeScript
const requestId = 'req_abc123def456';
const response = await fetch(
`https://api.helicone.ai/v1/request/${requestId}`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.HELICONE_API_KEY}`
}
}
);
const result = await response.json();
console.log(result.data);
Python
import os
import requests
request_id = "req_abc123def456"
response = requests.get(
f"https://api.helicone.ai/v1/request/{request_id}",
headers={
"Authorization": f"Bearer {os.environ['HELICONE_API_KEY']}"
}
)
result = response.json()
print(result["data"])
Get Request with Full Body
Retrieve request with full request and response bodies:cURL
curl --request GET \
--url 'https://api.helicone.ai/v1/request/req_abc123def456?includeBody=true' \
--header 'Authorization: Bearer <HELICONE_API_KEY>'
TypeScript
const requestId = 'req_abc123def456';
const response = await fetch(
`https://api.helicone.ai/v1/request/${requestId}?includeBody=true`,
{
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.HELICONE_API_KEY}`
}
}
);
const result = await response.json();
console.log(result.data.request_body);
console.log(result.data.response_body);
Python
import os
import requests
request_id = "req_abc123def456"
response = requests.get(
f"https://api.helicone.ai/v1/request/{request_id}",
params={"includeBody": True},
headers={
"Authorization": f"Bearer {os.environ['HELICONE_API_KEY']}"
}
)
result = response.json()
print(result["data"]["request_body"])
print(result["data"]["response_body"])
Extract Request ID from Response Headers
When making a request through Helicone, you can extract the request ID from the response headers:TypeScript
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://gateway.helicone.ai/v1',
defaultHeaders: {
'Helicone-Auth': `Bearer ${process.env.HELICONE_API_KEY}`
}
});
// Make a request and get the response with headers
const { data, response } = await client.chat.completions
.create({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello!' }]
})
.withResponse();
// Extract the request ID
const requestId = response.headers.get('helicone-id');
console.log('Request ID:', requestId);
// Now you can retrieve this request later
const requestDetails = await fetch(
`https://api.helicone.ai/v1/request/${requestId}`,
{
headers: {
'Authorization': `Bearer ${process.env.HELICONE_API_KEY}`
}
}
);
Python
from openai import OpenAI
import os
client = OpenAI(
base_url="https://gateway.helicone.ai/v1",
default_headers={
"Helicone-Auth": f"Bearer {os.environ['HELICONE_API_KEY']}"
}
)
# Make a request
response = client.with_raw_response.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": "Hello!"}]
)
# Extract the request ID
request_id = response.headers.get("helicone-id")
print(f"Request ID: {request_id}")
# Now you can retrieve this request later
import requests
request_details = requests.get(
f"https://api.helicone.ai/v1/request/{request_id}",
headers={
"Authorization": f"Bearer {os.environ['HELICONE_API_KEY']}"
}
)
Use Cases
Debugging Failed Requests
Retrieve full details of a failed request to debug issues:const debugRequest = async (requestId: string) => {
const response = await fetch(
`https://api.helicone.ai/v1/request/${requestId}?includeBody=true`,
{
headers: {
'Authorization': `Bearer ${process.env.HELICONE_API_KEY}`
}
}
);
const result = await response.json();
const request = result.data;
if (request.response_status >= 400) {
console.log('Failed request details:');
console.log('Status:', request.response_status);
console.log('Model:', request.model);
console.log('Error:', request.response_body?.error);
console.log('Request body:', request.request_body);
}
};
Cost Analysis
Analyze costs and tokens for specific requests:const analyzeRequest = async (requestId: string) => {
const response = await fetch(
`https://api.helicone.ai/v1/request/${requestId}`,
{
headers: {
'Authorization': `Bearer ${process.env.HELICONE_API_KEY}`
}
}
);
const result = await response.json();
const request = result.data;
console.log('Cost Analysis:');
console.log('Model:', request.model);
console.log('Total cost:', `$${request.cost}`);
console.log('Prompt tokens:', request.prompt_tokens);
console.log('Completion tokens:', request.completion_tokens);
console.log('Total tokens:', request.total_tokens);
console.log('Latency:', `${request.delay_ms}ms`);
};
Related Endpoints
Query Requests
Query multiple requests with filters
Add Feedback
Add feedback to this request
Add Properties
Add custom properties to this request
Add Scores
Add evaluation scores to this request
⌘I
