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

# Delete a session

> Permanently delete a session and all its associated state.

Args:
    session_id (`str`): The session to delete.
    user_id (`str`): Injected authenticated user ID.
    storage (`StorageBase`): Injected storage backend.

Raises:
    `HTTPException`: 404 if the session does not exist or does not belong
        to the authenticated user.



## OpenAPI

````yaml /versions/2.0.2/en/deploy/openapi.json delete /sessions/{session_id}
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.1
servers: []
security: []
paths:
  /sessions/{session_id}:
    delete:
      tags:
        - sessions
      summary: Delete a session
      description: |-
        Permanently delete a session and all its associated state.

        Args:
            session_id (`str`): The session to delete.
            user_id (`str`): Injected authenticated user ID.
            storage (`StorageBase`): Injected storage backend.

        Raises:
            `HTTPException`: 404 if the session does not exist or does not belong
                to the authenticated user.
      operationId: delete_session_sessions__session_id__delete
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
        - name: agent_id
          in: query
          required: true
          schema:
            type: string
            description: Agent the session belongs to.
            title: Agent Id
          description: Agent the session belongs to.
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      responses:
        '204':
          description: Successful Response
        '404':
          description: Not found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````