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

# Update an appointment



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json put /v1/appointments/{id}
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: '## Flextell API'
servers:
  - url: https://dev.flextell.ai/api
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/appointments/{id}:
    put:
      tags:
        - Appointment
      summary: Update an appointment
      operationId: appointment.update
      parameters:
        - name: id
          in: path
          required: true
          description: The appointment 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:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AppointmentUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/AppointmentResource'
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: object
                    properties:
                      message:
                        type: string
                        const: Appointment not found
                    required:
                      - message
                required:
                  - success
                  - data
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    AppointmentUpdateRequest:
      type: object
      properties:
        customer_id:
          type: integer
          description: The customer ID.
        user_id:
          type:
            - integer
            - 'null'
          description: The user ID.
        parent_appointment_id:
          type: string
          description: The parent appointment ID.
        relation_type:
          type:
            - string
            - 'null'
          description: Filter by appointment relation type (parent or child).
          enum:
            - parent
            - child
        description:
          type:
            - string
            - 'null'
          description: The description.
          maxLength: 1000
        scheduled_at:
          type:
            - string
            - 'null'
          format: date-time
          description: The scheduled at.
        status:
          type:
            - string
            - 'null'
          description: The status.
          enum:
            - pending
            - approved
            - cancelled
            - rejected
            - completed
            - no_show
        cancellation_reason:
          type:
            - string
            - 'null'
          description: The cancellation reason.
          maxLength: 1000
        room_id:
          type:
            - integer
            - 'null'
          description: The room ID.
        treatments:
          type: array
          description: The treatments.
          items:
            type: integer
            description: A treatments value.
        treatment_session_plans:
          type:
            - array
            - 'null'
          description: The treatment session plans.
          items:
            type: object
            properties:
              treatment_id:
                type: integer
                description: The treatment session plans.*.treatment ID.
              sessions:
                type: array
                description: The treatment session plans.*.sessions.
                items:
                  type: object
                  properties:
                    session_order:
                      type: integer
                      description: The treatment session plans.*.sessions.*.session order.
                      minimum: 1
                    session_type:
                      type:
                        - string
                        - 'null'
                      description: The treatment session plans.*.sessions.*.session type.
                      enum:
                        - control
                        - operation
                        - treatment
                        - consultation
                        - follow_up
                        - emergency
                        - surgery
                    offset_days:
                      type:
                        - integer
                        - 'null'
                      description: The treatment session plans.*.sessions.*.offset days.
                      minimum: 0
                    next_gap_days:
                      type:
                        - integer
                        - 'null'
                      description: The treatment session plans.*.sessions.*.next gap days.
                      minimum: 1
                    products:
                      type:
                        - array
                        - 'null'
                      description: The treatment session plans.*.sessions.*.products.
                      items:
                        type: object
                        properties:
                          product_id:
                            type: integer
                            description: >-
                              The treatment session
                              plans.*.sessions.*.products.*.product ID.
                          warehouse_id:
                            type:
                              - integer
                              - 'null'
                            description: >-
                              The treatment session
                              plans.*.sessions.*.products.*.warehouse ID.
                          quantity:
                            type: number
                            description: >-
                              The treatment session
                              plans.*.sessions.*.products.*.quantity.
                            minimum: 0.001
                  required:
                    - session_order
                minItems: 1
      title: AppointmentUpdateRequest
    AppointmentResource:
      type: object
      properties:
        id:
          type: integer
        customer_id:
          type: integer
        room_id:
          type:
            - integer
            - 'null'
        parent_appointment_id:
          type:
            - integer
            - 'null'
        code:
          type: string
        relation_type:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/AppointmentRelationType'
        description:
          type:
            - string
            - 'null'
        scheduled_at:
          type: string
          format: date-time
        status:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/AppointmentStatus'
        cancellation_reason:
          type:
            - string
            - 'null'
        creation_type:
          type: string
        customer:
          $ref: '#/components/schemas/CustomerResource'
        doctor:
          $ref: '#/components/schemas/RelatedUserResource'
        room:
          $ref: '#/components/schemas/RoomResource'
        parent_appointment:
          $ref: '#/components/schemas/AppointmentResource'
        child_appointments:
          type: array
          items:
            $ref: '#/components/schemas/AppointmentResource'
        treatments:
          type: array
          items:
            $ref: '#/components/schemas/TreatmentResource'
        assistants:
          anyOf:
            - type: array
              items:
                $ref: '#/components/schemas/RelatedUserResource'
            - type: array
              items:
                type: string
              minItems: 0
              maxItems: 0
              additionalItems: false
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - customer_id
        - room_id
        - parent_appointment_id
        - code
        - relation_type
        - description
        - scheduled_at
        - status
        - cancellation_reason
        - creation_type
        - assistants
        - created_at
        - updated_at
        - deleted_at
      title: AppointmentResource
    AppointmentRelationType:
      type: string
      enum:
        - parent
        - child
      title: AppointmentRelationType
    AppointmentStatus:
      type: string
      enum:
        - pending
        - approved
        - cancelled
        - rejected
        - completed
        - no_show
      title: AppointmentStatus
    CustomerResource:
      type: object
      properties:
        id:
          type: integer
        first_name:
          type:
            - string
            - 'null'
        last_name:
          type:
            - string
            - 'null'
        phone_number:
          type:
            - string
            - 'null'
        email:
          type:
            - string
            - 'null'
        date_of_birth:
          type:
            - string
            - 'null'
          format: date-time
        gender:
          anyOf:
            - $ref: '#/components/schemas/Gender'
            - type: 'null'
        country_name:
          type: string
        identity_number:
          type:
            - string
            - 'null'
        job:
          type:
            - string
            - 'null'
        address:
          type:
            - string
            - 'null'
        default_channel_id:
          type:
            - integer
            - 'null'
        avatar_url:
          type:
            - string
            - 'null'
        related_user:
          $ref: '#/components/schemas/RelatedUserResource'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/TagResource'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - first_name
        - last_name
        - phone_number
        - email
        - date_of_birth
        - gender
        - country_name
        - identity_number
        - job
        - address
        - default_channel_id
        - avatar_url
        - related_user
        - created_at
        - updated_at
        - deleted_at
      title: CustomerResource
    RelatedUserResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
        - id
        - name
      title: RelatedUserResource
    RoomResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        status:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/RoomStatus'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - name
        - status
        - created_at
        - updated_at
        - deleted_at
      title: RoomResource
    TreatmentResource:
      type: object
      properties:
        id:
          type: integer
        group_id:
          type:
            - integer
            - 'null'
        name:
          type: string
        keywords:
          type: array
          items: {}
        price:
          type: string
        tax_rate:
          type: integer
        description:
          type:
            - string
            - 'null'
        session:
          type: integer
        is_active:
          type: string
        extra_info:
          type: object
        group:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            name:
              type: string
            is_active:
              type: boolean
          required:
            - id
            - name
            - is_active
        users:
          type: array
          items:
            $ref: '#/components/schemas/RelatedUserResource'
        sessions:
          type: array
          items:
            $ref: '#/components/schemas/TreatmentSessionResource'
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - group_id
        - name
        - keywords
        - price
        - tax_rate
        - description
        - session
        - is_active
        - extra_info
        - created_at
        - updated_at
        - deleted_at
      title: TreatmentResource
    Gender:
      type: string
      enum:
        - male
        - female
        - other
      title: Gender
    TagResource:
      type: object
      properties:
        id:
          type: integer
        tenant_id:
          type: integer
        name:
          type: string
        color:
          type: string
        created_at:
          type:
            - string
            - 'null'
          format: date-time
        updated_at:
          type:
            - string
            - 'null'
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
      required:
        - id
        - tenant_id
        - name
        - color
        - created_at
        - updated_at
        - deleted_at
      title: TagResource
    RoomStatus:
      type: string
      enum:
        - active
        - inactive
        - maintenance
      title: RoomStatus
    TreatmentSessionResource:
      type: object
      properties:
        id:
          type: integer
        session_order:
          type: integer
        session_type:
          $ref: '#/components/schemas/AppointmentType'
        next_gap_days:
          type:
            - integer
            - 'null'
        offset_days:
          type: integer
        products:
          type: array
          items:
            $ref: '#/components/schemas/TreatmentSessionProductResource'
      required:
        - id
        - session_order
        - session_type
        - next_gap_days
        - offset_days
      title: TreatmentSessionResource
    AppointmentType:
      type: string
      enum:
        - control
        - operation
        - treatment
        - consultation
        - follow_up
        - emergency
        - surgery
      title: AppointmentType
    TreatmentSessionProductResource:
      type: object
      properties:
        id:
          type: integer
        product_id:
          type: integer
        min_quantity:
          type:
            - number
            - 'null'
        product:
          type: object
          properties:
            id:
              type: integer
            name:
              type: string
            full_name:
              type: string
            brand:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: integer
                name:
                  type: string
              required:
                - id
                - name
            unit_code:
              type:
                - object
                - 'null'
              properties:
                id:
                  type: string
                name:
                  type: string
                code:
                  type: string
              required:
                - id
                - name
                - code
          required:
            - id
            - name
            - full_name
            - brand
            - unit_code
      required:
        - id
        - product_id
        - min_quantity
      title: TreatmentSessionProductResource
  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

````