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

# Edit the proposed appointment of the pending AI suggestion before approval

> Rewrites the deferred insert_res booking action (doctor, schedule, treatments)
and the reply text. The appointment itself is created atomically only when the
suggestion is sent. Past dates are allowed; other business-hour rules are enforced.



## OpenAPI

````yaml put /v1/conversations/{id}/ai-suggestion/pending-appointment
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/conversations/{id}/ai-suggestion/pending-appointment:
    put:
      tags:
        - Conversation
      summary: >-
        Edit the proposed appointment of the pending AI suggestion before
        approval
      description: >-
        Rewrites the deferred insert_res booking action (doctor, schedule,
        treatments)

        and the reply text. The appointment itself is created atomically only
        when the

        suggestion is sent. Past dates are allowed; other business-hour rules
        are enforced.
      operationId: conversation.updatePendingAppointment
      parameters:
        - name: id
          in: path
          required: true
          description: The conversation identifier
          schema:
            type: integer
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ConversationAiSuggestionPendingAppointmentUpdateRequest
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/AiSuggestionResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  error_code:
                    type: string
                    const: RESOURCE_NOT_FOUND
                  message:
                    type: string
                  errors:
                    type: 'null'
                  data:
                    type: 'null'
                required:
                  - success
                  - error_code
                  - message
                  - errors
                  - data
        '409':
          $ref: '#/components/responses/CustomerErasedException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    ConversationAiSuggestionPendingAppointmentUpdateRequest:
      type: object
      properties:
        scheduled_at:
          type: string
          format: date-time
          description: >-
            The appointment date and time, interpreted in the tenant timezone
            (ISO 8601 or any parseable datetime).
        doctor_id:
          type: integer
          description: >-
            The assigned doctor identifier; must be a doctor belonging to the
            tenant.
          minimum: 1
        treatment_ids:
          type: array
          description: >-
            The treatment identifiers to book; each must be active and assigned
            to the selected doctor.
          items:
            type: integer
            description: >-
              A single treatment identifier that is active and offered by the
              selected doctor.
            minimum: 1
          minItems: 1
        message:
          type: string
          description: >-
            The reply text that will be sent alongside the appointment
            confirmation.
          maxLength: 4096
      required:
        - scheduled_at
        - doctor_id
        - treatment_ids
        - message
      title: ConversationAiSuggestionPendingAppointmentUpdateRequest
    AiSuggestionResource:
      type: object
      properties:
        id:
          type: integer
        conversation_id:
          type: integer
        original_text:
          type: string
        final_text:
          type:
            - string
            - 'null'
        status:
          type: string
        rating:
          type:
            - string
            - 'null'
        pending_actions:
          type: string
        attachments:
          type: string
        actions:
          type: string
        block_reason:
          type: string
        editable_insert:
          type: boolean
        found_treatments:
          type: array
          items:
            type: string
        editable_found_treatments:
          type: boolean
        trigger_chat_log_ids:
          type: array
          items: {}
        has_new_messages:
          type: boolean
        generated_at:
          type:
            - string
            - 'null'
        sent_at:
          type:
            - string
            - 'null'
        created_at:
          type:
            - string
            - 'null'
        updated_at:
          type:
            - string
            - 'null'
      required:
        - id
        - conversation_id
        - original_text
        - final_text
        - status
        - rating
        - pending_actions
        - attachments
        - actions
        - block_reason
        - editable_insert
        - found_treatments
        - editable_found_treatments
        - trigger_chat_log_ids
        - has_new_messages
        - generated_at
        - sent_at
        - created_at
        - updated_at
      title: AiSuggestionResource
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    CustomerErasedException:
      description: The patient record has been erased and is read-only
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
                description: Always false for an error.
                examples:
                  - false
              error_code:
                type: string
                description: Machine-readable error code.
                examples:
                  - CUSTOMER_ERASED
              message:
                type: string
                description: Localized error message.
            required:
              - success
              - error_code
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://dev.flextell.ai/oauth/authorize
          tokenUrl: https://dev.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

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