# Chat

## List Sessions

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

List all chat sessions for the current project.

### Query Parameters

- `organization_id: optional string`

- `page_size: optional number`

- `page_token: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Returns

- `items: array of object { last_updated_at, session_id, generated_title, 2 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.

  - `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

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{
  "items": [
    {
      "last_updated_at": "2026-04-22T12:34:41.342245",
      "session_id": "ses-abc123",
      "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

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

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

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `index_ids: optional array of string`

  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.

### Returns

- `last_updated_at: string`

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

- `session_id: string`

  Unique session identifier.

- `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

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat \
    -X POST \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "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

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

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

### Path Parameters

- `session_id: string`

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Returns

- `events: array of object { content, type }  or object { content, type }  or object { content, type }  or 5 more`

  Ordered list of events that make up the conversation history.

  - `ThinkingDelta = object { content, type }`

    - `content: string`

    - `type: optional "thinking_delta"`

      - `"thinking_delta"`

  - `TextDelta = object { content, type }`

    - `content: string`

    - `type: optional "text_delta"`

      - `"text_delta"`

  - `Thinking = object { content, type }`

    - `content: string`

    - `type: optional "thinking"`

      - `"thinking"`

  - `Text = object { content, type }`

    - `content: string`

    - `type: optional "text"`

      - `"text"`

  - `ToolCall = object { arguments, call_id, name, type }`

    - `arguments: map[unknown]`

    - `call_id: string`

    - `name: string`

    - `type: optional "tool_call"`

      - `"tool_call"`

  - `ToolResult = 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"`

  - `Stop = object { error, is_error, usage, type }`

    - `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`

    - `type: optional "stop"`

      - `"stop"`

  - `UserInput = 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.

- `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

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat/$SESSION_ID \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{
  "events": [
    {
      "content": "content",
      "type": "thinking_delta"
    }
  ],
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "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

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

Delete a session.

### Path Parameters

- `session_id: string`

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat/$SESSION_ID \
    -X DELETE \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

## Get Session Summary

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

Retrieve a session summary by ID.

### Path Parameters

- `session_id: string`

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Returns

- `last_updated_at: string`

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

- `session_id: string`

  Unique session identifier.

- `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

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat/$SESSION_ID/summary \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "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
  }
}
```

## Generate Session Title

**post** `/api/v1/chat/{session_id}/title`

Generate a title for a session from its first user message.

### Path Parameters

- `session_id: string`

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `first_message: string`

  First user message of the session, used to infer a short title.

### Returns

- `last_updated_at: string`

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

- `session_id: string`

  Unique session identifier.

- `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

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat/$SESSION_ID/title \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "first_message": "What were the main findings in Q3?"
        }'
```

#### Response

```json
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "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

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

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

### Path Parameters

- `session_id: string`

### Query Parameters

- `organization_id: optional string`

- `project_id: optional string`

### Cookie Parameters

- `session: optional string`

### Body Parameters

- `index_ids: array of string`

  Indexes to retrieve data from.

- `prompt: string`

  User message for this chat turn.

### Example

```http
curl https://api.cloud.llamaindex.ai/api/v1/chat/$SESSION_ID/messages/stream \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
    -d '{
          "index_ids": [
            "idx-abc123",
            "idx-def456"
          ],
          "prompt": "What were the main findings in Q3?"
        }'
```

#### Response

```json
{}
```

## Domain Types

### Chat List Response

- `ChatListResponse = object { last_updated_at, session_id, generated_title, 2 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.

  - `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`

### Chat Create Response

- `ChatCreateResponse = object { last_updated_at, session_id, generated_title, 2 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.

  - `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`

### Chat Retrieve Response

- `ChatRetrieveResponse = object { events, last_updated_at, session_id, 3 more }`

  Full chat session including its complete event history.

  - `events: array of object { content, type }  or object { content, type }  or object { content, type }  or 5 more`

    Ordered list of events that make up the conversation history.

    - `ThinkingDelta = object { content, type }`

      - `content: string`

      - `type: optional "thinking_delta"`

        - `"thinking_delta"`

    - `TextDelta = object { content, type }`

      - `content: string`

      - `type: optional "text_delta"`

        - `"text_delta"`

    - `Thinking = object { content, type }`

      - `content: string`

      - `type: optional "thinking"`

        - `"thinking"`

    - `Text = object { content, type }`

      - `content: string`

      - `type: optional "text"`

        - `"text"`

    - `ToolCall = object { arguments, call_id, name, type }`

      - `arguments: map[unknown]`

      - `call_id: string`

      - `name: string`

      - `type: optional "tool_call"`

        - `"tool_call"`

    - `ToolResult = 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"`

    - `Stop = object { error, is_error, usage, type }`

      - `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`

      - `type: optional "stop"`

        - `"stop"`

    - `UserInput = 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.

  - `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`

### Chat Get Summary Response

- `ChatGetSummaryResponse = object { last_updated_at, session_id, generated_title, 2 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.

  - `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`

### Chat Set Title Response

- `ChatSetTitleResponse = object { last_updated_at, session_id, generated_title, 2 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.

  - `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`

### Chat Stream Response

- `ChatStreamResponse = unknown`
