> ## 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 a treatment



## OpenAPI

````yaml https://dev.flextell.ai/docs/api.json put /v1/treatments/{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/treatments/{id}:
    put:
      tags:
        - Treatment
      summary: Update a treatment
      operationId: treatment.update
      parameters:
        - name: id
          in: path
          required: true
          description: The treatment 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/TreatmentUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/TreatmentResource'
                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: Treatment not found
                    required:
                      - message
                required:
                  - success
                  - data
        '422':
          $ref: '#/components/responses/ValidationException'
components:
  schemas:
    TreatmentUpdateRequest:
      type: object
      properties:
        name:
          type: string
          description: Treatment name.
          maxLength: 255
        group_id:
          type:
            - integer
            - 'null'
          description: >-
            Treatment group identifier (must belong to current tenant). Pass
            null to detach.
        price:
          type: number
          description: Treatment price.
          minimum: 0
        tax_rate:
          type: integer
          description: Tax rate (KDV).
          enum:
            - '0'
            - '1'
            - '10'
            - '20'
        description:
          type:
            - string
            - 'null'
          description: Treatment description.
          maxLength: 65535
        session:
          type:
            - integer
            - 'null'
          description: Number of sessions.
          minimum: 1
        is_active:
          type:
            - boolean
            - 'null'
          description: Active status.
        extra_info:
          type: object
          description: Extra information as associative key-value pairs.
          example:
            control_min_days: '7'
            minimum_cc: '2'
          additionalProperties:
            type: string
        keywords:
          type:
            - array
            - 'null'
          description: Search keywords for the treatment.
          items:
            type: string
            description: A keyword string.
            maxLength: 100
        sessions:
          type: array
          description: Treatment sessions plan.
          items:
            type: object
            properties:
              session_order:
                type: integer
                description: The sessions.*.session order.
                minimum: 1
              session_type:
                type:
                  - string
                  - 'null'
                description: The sessions.*.session type.
                enum:
                  - control
                  - operation
                  - treatment
                  - consultation
                  - follow_up
                  - emergency
                  - surgery
              next_gap_days:
                type:
                  - integer
                  - 'null'
                description: The sessions.*.next gap days.
                minimum: 1
              offset_days:
                type:
                  - integer
                  - 'null'
                description: The sessions.*.offset days.
                minimum: 0
              products:
                type:
                  - array
                  - 'null'
                description: Products used in this session.
                items:
                  type: object
                  properties:
                    product_id:
                      type: integer
                      description: The sessions.*.products.*.product ID.
                    min_quantity:
                      type:
                        - number
                        - 'null'
                      description: The sessions.*.products.*.min quantity.
                      minimum: 0
            required:
              - session_order
      title: TreatmentUpdateRequest
    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
    RelatedUserResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
      required:
        - id
        - name
      title: RelatedUserResource
    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

````