> ## 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.

# Shift all active appointments in a doctor's blocked range to the next available slots
and send patients a reschedule confirmation message

> Returns 202 Accepted: the pending slots and batch records are written synchronously,
while the patient confirmation messages are dispatched to the queue. A salesperson whose
range includes another rep's lead gets 403 `LEAD_NOT_ASSIGNED` and nothing moves.



## OpenAPI

````yaml /api-referansi/openapi.json post /v1/appointments/reschedule
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/appointments/reschedule:
    post:
      tags:
        - Appointment
      summary: >-
        Shift all active appointments in a doctor's blocked range to the next
        available slots

        and send patients a reschedule confirmation message
      description: >-
        Returns 202 Accepted: the pending slots and batch records are written
        synchronously,

        while the patient confirmation messages are dispatched to the queue. A
        salesperson whose

        range includes another rep's lead gets 403 `LEAD_NOT_ASSIGNED` and
        nothing moves.
      operationId: appointment.reschedule
      parameters:
        - 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/AppointmentRescheduleRequest'
      responses:
        '202':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    anyOf:
                      - type: object
                        properties:
                          processed:
                            type: integer
                          failed:
                            type: integer
                          skipped:
                            type: integer
                          superseded:
                            type: integer
                          items:
                            type: array
                            items:
                              anyOf:
                                - type: object
                                  properties:
                                    appointment_id:
                                      type: string
                                    status:
                                      type: string
                                      const: skipped
                                    reason_code:
                                      type: string
                                      const: CUSTOMER_ERASED
                                    reason:
                                      type: string
                                  required:
                                    - appointment_id
                                    - status
                                    - reason_code
                                    - reason
                                - type: object
                                  properties:
                                    appointment_id:
                                      type: string
                                    status:
                                      type: string
                                      const: failed
                                    reason:
                                      type: string
                                      const: No available slot found
                                  required:
                                    - appointment_id
                                    - status
                                    - reason
                                - type: object
                                  properties:
                                    appointment_id:
                                      type: string
                                    status:
                                      type: string
                                      const: processed
                                    was_pending:
                                      type: string
                                    original_at:
                                      type:
                                        - string
                                        - 'null'
                                    proposed_at:
                                      type: string
                                  required:
                                    - appointment_id
                                    - status
                                    - was_pending
                                    - original_at
                                    - proposed_at
                                - type: object
                                  properties:
                                    appointment_id:
                                      type: string
                                    status:
                                      type: string
                                      const: failed
                                    reason:
                                      type: string
                                  required:
                                    - appointment_id
                                    - status
                                    - reason
                          batch_id:
                            type: string
                        required:
                          - processed
                          - failed
                          - skipped
                          - superseded
                          - items
                          - batch_id
                      - type: object
                        properties:
                          processed:
                            type: integer
                          failed:
                            type: integer
                          skipped:
                            type: integer
                          items:
                            type: array
                            items:
                              type: string
                            minItems: 0
                            maxItems: 0
                            additionalItems: false
                          batch_id:
                            type: 'null'
                        required:
                          - processed
                          - failed
                          - skipped
                          - items
                          - batch_id
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '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:
    AppointmentRescheduleRequest:
      type: object
      properties:
        user_id:
          type: integer
          description: The doctor whose schedule is being blocked.
          minimum: 1
        blocked_from:
          type: string
          format: date-time
          description: Start of the blocked range (inclusive).
        blocked_until:
          type: string
          format: date-time
          description: End of the blocked range (exclusive).
      required:
        - user_id
        - blocked_from
        - blocked_until
      title: AppointmentRescheduleRequest
  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
    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.