> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pathors.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Session

> Retrieve session information by session ID to view conversation context and variables.

<Warning>
  **Deprecated.** This endpoint is deprecated and will be **sunset on 2026-07-11**. It still works until then. Migrate to the V1 path -- see the [migration guide](/en/migrations/2026-06-outbound-api-v1) for the old -> new path table.
</Warning>

Query an existing session to retrieve its data, including variables and conversation history.

## Base URL

```
https://api.pathors.com
```

## Query Session

```bash theme={null}
GET https://api.pathors.com/project/{projectId}/session/{sessionId}
```

### Path Parameters

<ParamField path="projectId" type="string" required>
  The ID of your project
</ParamField>

<ParamField path="sessionId" type="string" required>
  The unique identifier of the session to query
</ParamField>

### Request Headers

<ParamField header="Authorization" type="string" required>
  Bearer token authentication using your Project API Key (starts with `sk_`). Format: `Bearer {your-api-key}`
</ParamField>

### Response

<ResponseField name="sessionId" type="string">
  The session ID
</ResponseField>

<ResponseField name="state" type="object">
  The session state containing variables, messages, and other execution state information
</ResponseField>

## Example

### Request

```bash theme={null}
curl -X GET https://api.pathors.com/project/{projectId}/session/user-123-session-456 \
  --header 'Authorization: Bearer <token>'
```

### Response

```json theme={null}
{
  "sessionId": "user-123-session-456",
  "state": {
    "variables": {
      "userName": "John Doe",
      "userRole": "admin"
    },
    "messages": [
      {
        "role": "user",
        "content": "Hello"
      },
      {
        "role": "assistant",
        "content": "Hi! How can I help you today?"
      }
    ]
  }
}
```

## Usage Notes

* **Session ID**: Use the same session ID that was created via the [Create Session](/api-reference/session/create-session) endpoint
* **State Structure**: The `state` field contains the session execution state including variables and conversation history

## Error Responses

| Status Code | Description                    |
| ----------- | ------------------------------ |
| 400         | Missing projectId or sessionId |
| 401         | Invalid authentication         |
| 404         | Session not found              |
| 500         | Internal server error          |

Example error responses:

**404 Not Found:**

```json theme={null}
{
  "error": "Session not found"
}
```

**401 Unauthorized:**

```json theme={null}
{
  "error": {
    "message": "Invalid authentication"
  }
}
```

## Related APIs

* [Create Session](/api-reference/session/create-session) - Create a new session
* [Search Sessions](/api-reference/session/search-sessions) - Search sessions by content
* [End Session](/api-reference/session/end-session) - End an existing session
