# Chat

## List Sessions

`$ llp chat list`

**get** `/api/v1/chat`

List all chat sessions for the current project.

### Parameters

- `--organization-id: optional string`

- `--page-size: optional number`

- `--page-token: optional string`

- `--project-id: optional string`

### Returns

- `SessionList: object { items, next_page_token }`

  Paginated list of chat sessions.

  - `items: array of object { last_updated_at, session_id, shared_access, 3 more }`

    Chat sessions for the current page.

    - `last_updated_at: string`

      ISO-format timestamp showing when the session was last updated.

    - `session_id: string`

      Unique session identifier.

    - `shared_access: "query" or "read_only"`

      What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

      - `"query"`

      - `"read_only"`

    - `generated_title: optional string`

      Auto-generated title derived from the first user message.

    - `index_ids: optional array of string`

      Indexes this session is bound to. Null on unbound sessions.

    - `job_metadata: optional object { duration_ms, error, export_config_ids, 4 more }`

      Token usage and status from the most recent run. Null if the session has not been run yet.

      - `duration_ms: optional number`

      - `error: optional string`

      - `export_config_ids: optional array of string`

      - `is_error: optional boolean`

      - `total_input_tokens: optional number`

      - `total_output_tokens: optional number`

      - `turns: optional number`

  - `next_page_token: optional string`

    Opaque token to retrieve the next page. Omitted when there are no further pages.

### Example

```cli
llp chat list \
  --api-key 'My API Key'
```

#### Response

```json
{
  "items": [
    {
      "last_updated_at": "2026-04-22T12:34:41.342245",
      "session_id": "ses-abc123",
      "shared_access": "read_only",
      "generated_title": "What were the main findings in Q3?...",
      "index_ids": [
        "idx-abc123",
        "idx-def456"
      ],
      "job_metadata": {
        "duration_ms": 0,
        "error": "error",
        "export_config_ids": [
          "string"
        ],
        "is_error": true,
        "total_input_tokens": 0,
        "total_output_tokens": 0,
        "turns": 0
      }
    }
  ],
  "next_page_token": "next_page_token"
}
```

## Create Session

`$ llp chat create`

**post** `/api/v1/chat`

Create a chat session, optionally bound to indexes (locked after the first message).

### Parameters

- `--organization-id: optional string`

  Query param

- `--project-id: optional string`

  Query param

- `--index-id: optional array of string`

  Body param: Indexes this session will retrieve from. Once set and the first message has been sent, the source set is locked for the session's lifetime. Leave null to create an unbound session.

- `--shared-access: optional "query" or "read_only"`

  Body param: What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions). Null follows the deployment default.

### Returns

- `ChatNewResponse: object { last_updated_at, session_id, shared_access, 3 more }`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" or "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title: optional string`

    Auto-generated title derived from the first user message.

  - `index_ids: optional array of string`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata: optional object { duration_ms, error, export_config_ids, 4 more }`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms: optional number`

    - `error: optional string`

    - `export_config_ids: optional array of string`

    - `is_error: optional boolean`

    - `total_input_tokens: optional number`

    - `total_output_tokens: optional number`

    - `turns: optional number`

### Example

```cli
llp chat create \
  --api-key 'My API Key'
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Get Full Session

`$ llp chat retrieve`

**get** `/api/v1/chat/{session_id}`

Retrieve a full session by ID, including its event history.

### Parameters

- `--session-id: string`

- `--organization-id: optional string`

- `--project-id: optional string`

### Returns

- `ChatGetResponse: object { events, last_updated_at, session_id, 4 more }`

  Full chat session including its complete event history.

  - `events: array of object { error, is_error, usage, 2 more }  or object { content, type }  or object { content, type }  or 5 more`

    Ordered list of events that make up the conversation history.

    - `stop: object { error, is_error, usage, 2 more }`

      - `error: string`

      - `is_error: boolean`

      - `usage: object { duration_ms, total_input_tokens, total_output_tokens, turns }`

        - `duration_ms: optional number`

        - `total_input_tokens: optional number`

        - `total_output_tokens: optional number`

        - `turns: optional number`

      - `skipped_index_ids: optional array of string`

        Requested indexes this turn could not query.

      - `type: optional "stop"`

        - `"stop"`

    - `text_delta: object { content, type }`

      - `content: string`

      - `type: optional "text_delta"`

        - `"text_delta"`

    - `text: object { content, type }`

      - `content: string`

      - `type: optional "text"`

        - `"text"`

    - `thinking_delta: object { content, type }`

      - `content: string`

      - `type: optional "thinking_delta"`

        - `"thinking_delta"`

    - `thinking: object { content, type }`

      - `content: string`

      - `type: optional "thinking"`

        - `"thinking"`

    - `tool_call: object { arguments, call_id, name, type }`

      - `arguments: map[unknown]`

      - `call_id: string`

      - `name: string`

      - `type: optional "tool_call"`

        - `"tool_call"`

    - `tool_result: object { call_id, name, result, 2 more }`

      - `call_id: string`

      - `name: string`

      - `result: unknown`

      - `image_attachment: optional object { attachment_name, source_id }`

        Coordinates for lazily resolving a page screenshot presigned URL.

        - `attachment_name: string`

        - `source_id: string`

      - `type: optional "tool_result"`

        - `"tool_result"`

    - `user_input: object { content, type }`

      - `content: string`

      - `type: optional "user_input"`

        - `"user_input"`

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" or "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title: optional string`

    Auto-generated title derived from the first user message.

  - `index_ids: optional array of string`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata: optional object { duration_ms, error, export_config_ids, 4 more }`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms: optional number`

    - `error: optional string`

    - `export_config_ids: optional array of string`

    - `is_error: optional boolean`

    - `total_input_tokens: optional number`

    - `total_output_tokens: optional number`

    - `turns: optional number`

### Example

```cli
llp chat retrieve \
  --api-key 'My API Key' \
  --session-id session_id
```

#### Response

```json
{
  "events": [
    {
      "error": "error",
      "is_error": true,
      "usage": {
        "duration_ms": 0,
        "total_input_tokens": 0,
        "total_output_tokens": 0,
        "turns": 0
      },
      "skipped_index_ids": [
        "string"
      ],
      "type": "stop"
    }
  ],
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Delete Session

`$ llp chat delete`

**delete** `/api/v1/chat/{session_id}`

Delete a session.

### Parameters

- `--session-id: string`

- `--organization-id: optional string`

- `--project-id: optional string`

### Example

```cli
llp chat delete \
  --api-key 'My API Key' \
  --session-id session_id
```

## Get Session Summary

`$ llp chat get-summary`

**get** `/api/v1/chat/{session_id}/summary`

Retrieve a session summary by ID.

### Parameters

- `--session-id: string`

- `--organization-id: optional string`

- `--project-id: optional string`

### Returns

- `ChatGetSummaryResponse: object { last_updated_at, session_id, shared_access, 3 more }`

  Summary of a chat session, including its title and last run metadata.

  - `last_updated_at: string`

    ISO-format timestamp showing when the session was last updated.

  - `session_id: string`

    Unique session identifier.

  - `shared_access: "query" or "read_only"`

    What this chat's share link grants: read_only (transcript only) or query (viewers may ask new questions).

    - `"query"`

    - `"read_only"`

  - `generated_title: optional string`

    Auto-generated title derived from the first user message.

  - `index_ids: optional array of string`

    Indexes this session is bound to. Null on unbound sessions.

  - `job_metadata: optional object { duration_ms, error, export_config_ids, 4 more }`

    Token usage and status from the most recent run. Null if the session has not been run yet.

    - `duration_ms: optional number`

    - `error: optional string`

    - `export_config_ids: optional array of string`

    - `is_error: optional boolean`

    - `total_input_tokens: optional number`

    - `total_output_tokens: optional number`

    - `turns: optional number`

### Example

```cli
llp chat get-summary \
  --api-key 'My API Key' \
  --session-id session_id
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "shared_access": "read_only",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
```

## Stream Messages

`$ llp chat stream`

**post** `/api/v1/chat/{session_id}/messages/stream`

Stream agent events for a chat turn as Server-Sent Events.

### Parameters

- `--session-id: string`

  Path param

- `--index-id: array of string`

  Body param: Indexes to retrieve data from.

- `--prompt: string`

  Body param: User message for this chat turn.

- `--organization-id: optional string`

  Query param

- `--project-id: optional string`

  Query param

- `--require-all-indexes: optional boolean`

  Body param: Fail the turn if any requested index cannot be queried.

### Returns

- `ChatStreamResponse: unknown`

### Example

```cli
llp chat stream \
  --api-key 'My API Key' \
  --session-id session_id \
  --index-id idx-abc123 \
  --index-id idx-def456 \
  --prompt 'What were the main findings in Q3?'
```

#### Response

```json
{}
```
