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

# Delete Session Chat

> Removes the chat (cascade clears `chat_messages` and `chat_reads`). Refuses with 400 if this is the only chat in the session — sessions must always retain at least one chat.



## OpenAPI

````yaml api-reference/openapi/sessions.json DELETE /api/sessions/{sessionId}/chats/{chatId}
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/{chatId}:
    delete:
      summary: Delete session chat
      description: >-
        Removes the chat (cascade clears `chat_messages` and `chat_reads`).
        Refuses with 400 if this is the only chat in the session — sessions must
        always retain at least one chat.
      parameters:
        - name: sessionId
          in: path
          required: true
          description: The id of the parent session.
          schema:
            type: string
        - name: chatId
          in: path
          required: true
          description: The id of the chat being deleted.
          schema:
            type: string
      responses:
        '200':
          description: Chat deleted successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteSessionChatResponse'
        '400':
          description: Cannot delete the only chat in a session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '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, the chat does not
            exist, or the chat belongs to a different session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Server error — the chat could not be deleted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    DeleteSessionChatResponse:
      type: object
      required:
        - success
      properties:
        success:
          type: boolean
          enum:
            - true
    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.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
    BearerAuth:
      type: http
      scheme: bearer

````