# List Session Chats

Source: https://recoupable.dev/docs/api-reference/sessions/list-chats

List session chats

## GET /api/sessions/{sessionId}/chats

Full OpenAPI specification: https://recoupable.dev/docs/spec/sessions.json

## Authentication

This operation requires one of the security alternatives in the specification below. Security scheme definitions are included where present in the published specification.

[Authentication guide](https://recoupable.dev/docs/authentication)

## Operation and referenced schemas

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Recoup API - Sessions",
    "description": "Sessions — sandboxed runs of an LLM-driven agent with tool use, lifecycle hooks, and persistence. Each session pairs one Vercel Sandbox with one or more chat threads.",
    "license": {
      "name": "MIT"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.recoupable.dev"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/api/sessions/{sessionId}/chats": {
      "get": {
        "summary": "List session chats",
        "description": "Lists every chat in the given session as a `ChatSummary` (chat row plus per-account `hasUnread` and `isStreaming` flags), along with the caller's default model id. Chats are sorted by `createdAt` ascending.",
        "parameters": [
          {
            "name": "sessionId",
            "in": "path",
            "required": true,
            "description": "The id of the parent session.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chats retrieved successfully.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListSessionChatsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — invalid or missing API key / Bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — the authenticated account does not own this session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Not found — no session exists with the given id.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ListSessionChatsResponse": {
        "type": "object",
        "required": [
          "chats",
          "defaultModelId"
        ],
        "properties": {
          "chats": {
            "type": "array",
            "description": "Every chat in the session, sorted by `createdAt` ascending.",
            "items": {
              "$ref": "#/components/schemas/ChatSummary"
            }
          },
          "defaultModelId": {
            "type": "string",
            "description": "Default model id surfaced to clients with no explicit preference (e.g. `openai/gpt-5.4`)."
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "status",
          "error"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "error"
            ],
            "description": "Always `\"error\"` for error responses."
          },
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          }
        }
      },
      "ChatSummary": {
        "type": "object",
        "description": "Chat row enriched with per-account `hasUnread` and computed `isStreaming` flags for chat-list rendering.",
        "required": [
          "id",
          "sessionId",
          "title",
          "createdAt",
          "updatedAt",
          "hasUnread",
          "isStreaming"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "sessionId": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "modelId": {
            "type": "string",
            "nullable": true
          },
          "activeStreamId": {
            "type": "string",
            "nullable": true
          },
          "lastAssistantMessageAt": {
            "type": "string",
            "format": "date-time",
            "nullable": true
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "hasUnread": {
            "type": "boolean",
            "description": "True when `lastAssistantMessageAt` is newer than the caller's `chat_reads.last_read_at` (or no read row exists yet)."
          },
          "isStreaming": {
            "type": "boolean",
            "description": "True when `activeStreamId` is non-null."
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
```
