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

# stop session

> Force-terminates a running session. The engine hosting the session
disconnects the client and shuts the session down immediately.

Termination is asynchronous on the engine side: the session's
`endTime`, exit status and session report are delivered through the
normal end-of-session flow shortly after the stop, so the session may
briefly still appear active on `GET /v1/sessions/{id}`.

Stopping a session that has already ended returns `200` without
contacting the engine, so repeating a stop is safe. That includes a
session whose end reaches Lab while the stop is in flight.

Running sessions that never reached an engine, or that run over the
LiveKit or Agora integrations, have no engine host to terminate and
return `404`. If the engine does not confirm the stop of a running
session, the request fails with `502`.




## OpenAPI

````yaml https://api.anam.ai/swagger.json post /v1/sessions/{id}/stop
openapi: 3.1.0
info:
  title: Anam AI API
  version: '1.0'
servers:
  - url: https://api.anam.ai
    description: Anam API
security:
  - BearerAuth: []
tags:
  - name: Sessions
  - name: Avatar Videos
  - name: Meetings
  - name: Personas
  - name: Avatars
  - name: Voices
  - name: Pronunciation Dictionaries
  - name: LLMs
  - name: Knowledge
  - name: Tools
  - name: Share Links
  - name: Engine
paths:
  /v1/sessions/{id}/stop:
    post:
      tags:
        - Sessions
      summary: stop session
      description: |
        Force-terminates a running session. The engine hosting the session
        disconnects the client and shuts the session down immediately.

        Termination is asynchronous on the engine side: the session's
        `endTime`, exit status and session report are delivered through the
        normal end-of-session flow shortly after the stop, so the session may
        briefly still appear active on `GET /v1/sessions/{id}`.

        Stopping a session that has already ended returns `200` without
        contacting the engine, so repeating a stop is safe. That includes a
        session whose end reaches Lab while the stop is in flight.

        Running sessions that never reached an engine, or that run over the
        LiveKit or Agora integrations, have no engine host to terminate and
        return `404`. If the engine does not confirm the stop of a running
        session, the request fails with `502`.
      operationId: stopSession
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
          required: true
          description: Session ID
      responses:
        '200':
          description: >-
            The engine accepted the stop request, or the session had already
            ended
          content:
            application/json:
              schema:
                type: object
        '400':
          description: Bad request - Invalid session ID
        '401':
          description: Unauthorized - Invalid or missing API key
        '403':
          description: >-
            Forbidden - API key is not permitted to stop sessions (it needs
            write access to sessions)
        '404':
          description: >-
            Not Found - Session not found, or it is running with no engine to
            terminate (it never reached an engine, is a LiveKit/Agora session,
            or its engine no longer has it)
        '500':
          description: Server error
        '502':
          description: >-
            Bad Gateway - The engine hosting the running session did not confirm
            the stop. The session may still be running. Retry a few times with
            backoff.
        '503':
          description: >-
            The API key could not be checked because of a temporary server
            problem. The key may be valid; retry after `Retry-After` seconds.
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServiceUnavailableError'
components:
  schemas:
    ServiceUnavailableError:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          example: Service temporarily unavailable
        message:
          type: string
          example: We could not check your API key. Please retry shortly.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.