The Request API allows you to fetch all requests associated with a specific session ID, making it easy to analyze conversation threads.

Retrieving Session Data

Here’s how to fetch all requests for a specific session:

const response = await fetch("https://api.helicone.ai/v1/request/query", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${HELICONE_API_KEY}`,
  },
  body: JSON.stringify({
    filter: {
      properties: {
        "Helicone-Session-Id": {
          equals: SESSION_ID_TO_REPLAY,
        },
      },
    },
  }),
});
const data = await response.json();

The response includes these key fields for each request:

  • request_created_at: Timestamp of the request
  • request_properties["Helicone-Session-Id"]: Session identifier
  • signed_body_url: URL to access the request and response body from S3
  • request_path: API endpoint path
  • request_properties["Helicone-Session-Path"]: Session path
  • request_properties["Helicone-Prompt-Id"]: Unique prompt identifier
  • body: Deprecated, use signed_body_url instead
  • other fields: See the Request API reference for more details