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

# Update Conversation Status

> Updates the status of a conversation. Only transitions to `completed`, `handed_off`, or `dropped` are allowed. Requires `conversations:change_status` permission.




## OpenAPI

````yaml PATCH /api/conversations/{id}/status
openapi: 3.1.0
info:
  title: Conversations API
  description: API for managing LLM-driven lead qualification conversations.
  version: 1.0.0
servers:
  - url: '{baseUrl}'
    description: API server
    variables:
      baseUrl:
        default: http://localhost:3001
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /api/conversations/{id}/status:
    patch:
      tags:
        - Conversations
      summary: Update Conversation Status
      description: >
        Updates the status of a conversation. Only transitions to `completed`,
        `handed_off`, or `dropped` are allowed. Requires
        `conversations:change_status` permission.
      operationId: updateConversationStatus
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: MongoDB ObjectId of the conversation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  enum:
                    - completed
                    - handed_off
                    - dropped
                  description: The new status for the conversation.
              required:
                - status
      responses:
        '200':
          description: Status updated successfully. Returns the updated conversation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Conversation'
        '400':
          description: Invalid status value.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 'Invalid status. Must be: completed, handed_off, or dropped'
        '404':
          description: Conversation not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: Conversation not found
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Conversation:
      type: object
      properties:
        _id:
          type: string
          description: MongoDB ObjectId of the conversation.
          example: 665f1a2b3c4d5e6f7a8b9c0d
        leadId:
          type: string
          description: The ID of the associated lead.
        accountId:
          type: string
          description: MongoDB ObjectId of the account (tenant).
        agentConfigId:
          type: string
          description: MongoDB ObjectId of the agent configuration used.
        campaignId:
          type: string
          description: >-
            MongoDB ObjectId of the campaign, if conversation was started by a
            campaign.
        channel:
          type: string
          enum:
            - whatsapp
            - telegram
            - email
          description: The messaging channel used for this conversation.
        leadPhone:
          type: string
          description: The lead's phone number.
        leadEmail:
          type: string
          description: The lead's email address.
        status:
          type: string
          enum:
            - active
            - completed
            - handed_off
            - dropped
          description: Current status of the conversation.
        currentStageIndex:
          type: integer
          description: Index of the current conversation stage.
        currentStageName:
          type: string
          description: Name of the current conversation stage.
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ConversationMessage'
          description: Ordered list of messages in the conversation.
        summary:
          type: string
          description: LLM-generated summary of the conversation.
        qualificationResult:
          $ref: '#/components/schemas/QualificationResult'
        messageCount:
          type: integer
          description: Total number of messages in the conversation.
        createdAt:
          type: string
          format: date-time
          description: When the conversation was created.
        updatedAt:
          type: string
          format: date-time
          description: When the conversation was last updated.
      required:
        - _id
        - leadId
        - accountId
        - agentConfigId
        - channel
        - leadPhone
        - status
        - currentStageIndex
        - messages
        - messageCount
        - createdAt
        - updatedAt
    Error:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
      required:
        - error
    ConversationMessage:
      type: object
      properties:
        role:
          type: string
          enum:
            - agent
            - lead
          description: The sender role of the message.
        content:
          type: string
          description: The text content of the message.
        timestamp:
          type: string
          format: date-time
          description: When the message was sent.
        agentConfigId:
          type: string
          description: The agent config used when generating this message.
      required:
        - role
        - content
        - timestamp
    QualificationResult:
      type: object
      properties:
        qualified:
          type: boolean
          description: Whether the lead was qualified.
        reason:
          type: string
          description: Explanation of the qualification decision.
      required:
        - qualified
        - reason
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: API key for programmatic access (format nl_live_* or nl_test_*)
    BearerAuth:
      type: http
      scheme: bearer
      description: Bearer token using an API key (format nl_live_* or nl_test_*)

````