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

# End a conversation

> Ends a **text** conversation, marking it `completed`. Idempotent — ending an already-completed conversation returns its record unchanged.

Text conversations only; other channels return `409`. Requires a token with write access.



## OpenAPI

````yaml /openapi.json post /core/conversations/{conversation_id}/end
openapi: 3.0.3
info:
  title: AnyReach API
  version: 1.0.0
  description: REST API for the AnyReach platform.
servers:
  - url: https://api.anyreach.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Conversations
    description: >-
      Create, list, retrieve, and message conversations between your users and
      AnyReach agents.
paths:
  /core/conversations/{conversation_id}/end:
    post:
      tags:
        - Conversations
      summary: End a conversation
      description: >-
        Ends a **text** conversation, marking it `completed`. Idempotent —
        ending an already-completed conversation returns its record unchanged.


        Text conversations only; other channels return `409`. Requires a token
        with write access.
      operationId: endConversation
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
          description: The text conversation to end.
      responses:
        '200':
          description: The conversation was ended (or was already completed).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EndConversationResponse'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The conversation is not a text channel, or is in a non-active,
            non-completed state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    EndConversationResponse:
      type: object
      properties:
        conversation_id:
          type: string
          description: The conversation that was ended.
        status:
          $ref: '#/components/schemas/Status'
          description: The conversation status after ending — always completed.
        duration:
          type: integer
          nullable: true
          description: The conversation's wall-clock duration in seconds.
        summary:
          type: string
          nullable: true
          description: A short summary of the conversation, when one was generated.
    Error:
      type: object
      properties:
        detail:
          type: string
          description: A human-readable description of the error.
          example: Conversation not found
    Status:
      type: string
      enum:
        - token_created
        - triggered
        - ringing
        - in_progress
        - completed
        - failed
        - cancelled
        - transferred
        - unanswered
      description: Current state of the conversation.
  responses:
    Forbidden:
      description: The token's role doesn't grant access to this action.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The conversation does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Personal access token. See Authentication.

````