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

# Get the sale items of an appointment

> Prefill lines for creating a sale from the appointment: its treatments (deduplicated,
including those behind its linked sessions) followed by the products recorded on the
sessions linked to it, summed per product. Product quantities are in the product's base
unit, so prices are the box price divided by the units per box. Every line is credited
to the appointment's practitioner.



## OpenAPI

````yaml /api-referansi/openapi.json get /v1/appointments/{id}/sale-items
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/{id}/sale-items:
    get:
      tags:
        - Appointment
      summary: Get the sale items of an appointment
      description: >-
        Prefill lines for creating a sale from the appointment: its treatments
        (deduplicated,

        including those behind its linked sessions) followed by the products
        recorded on the

        sessions linked to it, summed per product. Product quantities are in the
        product's base

        unit, so prices are the box price divided by the units per box. Every
        line is credited

        to the appointment's practitioner.
      operationId: appointment.saleItems
      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
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/AppointmentSaleItemResource'
                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
        '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:
    AppointmentSaleItemResource:
      type: object
      properties:
        itemable_type:
          type: string
          enum:
            - Treatment
            - Product
        itemable_id:
          type: integer
        name:
          type: string
        quantity:
          type: number
          description: >-
            Quantity; product quantities are summed across the appointment's
            sessions and expressed in the product's base unit.
        unit_price:
          type: number
          description: >-
            Unit price excluding tax (product prices are already divided by the
            units per box).
        tax_rate:
          type: number
        cost_price:
          type: number
          description: Unit cost price (per base unit for products, 0 for treatments).
        sub_total:
          type: number
        total_tax:
          type: number
        total_price:
          type: number
        staff_id:
          type:
            - integer
            - 'null'
          description: Staff member credited for the line (the appointment's practitioner).
      required:
        - itemable_type
        - itemable_id
        - name
        - quantity
        - unit_price
        - tax_rate
        - cost_price
        - sub_total
        - total_tax
        - total_price
        - staff_id
      title: AppointmentSaleItemResource
  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.