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



## OpenAPI

````yaml /api-referansi/openapi.json put /v1/offers/{id}
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/offers/{id}:
    put:
      tags:
        - Offers
      summary: Update an offer
      operationId: offers.update
      parameters:
        - name: id
          in: path
          required: true
          description: The offer 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/OfferUpdateRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                  data:
                    $ref: '#/components/schemas/OfferResource'
                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:
    OfferUpdateRequest:
      type: object
      properties:
        customer_id:
          type: integer
          description: Customer ID. Must belong to current tenant.
        currency_id:
          type: integer
          description: Currency ID.
        exchange_rate:
          type: number
          description: Exchange rate (e.g. 1 or 34.5).
          minimum: 0
        valid_until:
          type: string
          format: date-time
          description: Date until which the offer is valid.
        status:
          type: string
          description: 'Offer status: draft, sent, accepted, rejected.'
          enum:
            - draft
            - sent
            - accepted
            - rejected
        user_id:
          type:
            - integer
            - 'null'
          description: User ID (optional).
        notes:
          type:
            - string
            - 'null'
          description: Notes (optional).
          maxLength: 65535
        items:
          type: array
          description: Offer line items (optional on update).
          items:
            type: object
            properties:
              itemable_type:
                type: string
                description: 'Polymorphic type: Treatment or Product.'
                enum:
                  - Treatment
                  - Product
                  - App\Models\Treatment
                  - App\Models\Product
              itemable_id:
                type: integer
                description: ID of the treatment or product.
                minimum: 1
              quantity:
                type: number
                description: Quantity.
                minimum: 0.0001
              unit_price:
                type: number
                description: Unit price.
                minimum: 0
              tax_rate:
                type: integer
                description: Tax rate (0, 1, 10, or 20).
                enum:
                  - '0'
                  - '1'
                  - '10'
                  - '20'
              discount_amount:
                type: number
                description: Discount amount.
                minimum: 0
              discount_percentage:
                type: number
                description: Discount percentage (0-100).
                minimum: 0
                maximum: 100
              sub_total:
                type:
                  - number
                  - 'null'
                description: >-
                  Sub-total before tax and discount (optional, will be
                  server-calculated if omitted).
                minimum: 0
              total_discount:
                type:
                  - number
                  - 'null'
                description: >-
                  Total discount applied (optional, will be server-calculated if
                  omitted).
                minimum: 0
              total_tax:
                type:
                  - number
                  - 'null'
                description: Total tax (optional, will be server-calculated if omitted).
                minimum: 0
              total_price:
                type:
                  - number
                  - 'null'
                description: >-
                  Total price for this item (optional, will be server-calculated
                  if omitted).
                minimum: 0
              order:
                type:
                  - integer
                  - 'null'
                description: Display order (optional).
                minimum: 0
            required:
              - itemable_type
              - itemable_id
              - quantity
              - unit_price
              - tax_rate
              - discount_amount
              - discount_percentage
          minItems: 1
      title: OfferUpdateRequest
    OfferResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        tenant_id:
          type: integer
        user_id:
          type:
            - integer
            - 'null'
        customer_id:
          type:
            - integer
            - 'null'
        sale_id:
          type:
            - integer
            - 'null'
        currency_id:
          type:
            - integer
            - 'null'
        exchange_rate:
          type: number
        valid_until:
          type: string
          format: date-time
        notes:
          type:
            - string
            - 'null'
        status:
          type: string
        is_locked:
          type: boolean
          description: 'Accepted or converted: update and delete return 422 `OFFER_LOCKED`.'
        can_convert:
          type: boolean
          description: False once the offer is rejected or converted.
        total_price:
          type: number
        customer:
          $ref: '#/components/schemas/RelatedCustomerResource'
        user:
          $ref: '#/components/schemas/RelatedUserResource'
        currency:
          $ref: '#/components/schemas/RelatedCurrencyResource'
        items:
          type: array
          items:
            $ref: '#/components/schemas/OfferItemResource'
        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
        - record_state
        - tenant_id
        - user_id
        - customer_id
        - sale_id
        - currency_id
        - exchange_rate
        - valid_until
        - notes
        - status
        - is_locked
        - can_convert
        - total_price
        - created_at
        - updated_at
        - deleted_at
      title: OfferResource
    RecordStateResource:
      type: object
      properties:
        is_read_only:
          type: boolean
          description: >-
            True when every write on this record is refused; false does not
            imply the caller may write.
        reason_code:
          type:
            - string
            - 'null'
          description: >-
            Why the record is read-only (`CUSTOMER_ERASED`, or
            `LEAD_NOT_ASSIGNED` for a salesperson on another rep's lead), or
            null when it is not.
      required:
        - is_read_only
        - reason_code
      title: RecordStateResource
    RelatedCustomerResource:
      type: object
      properties:
        id:
          type: integer
        record_state:
          $ref: '#/components/schemas/RecordStateResource'
        first_name:
          anyOf:
            - type: string
            - type: 'null'
        last_name:
          anyOf:
            - type: string
            - type: 'null'
        phone_number:
          anyOf:
            - type: string
            - type: 'null'
        email:
          anyOf:
            - type: string
            - type: 'null'
        is_masked:
          type: boolean
          description: >-
            Whether the identity fields are masked because the viewer may not
            see this lead's patient.
        is_lead_stage:
          type: boolean
          description: >-
            Whether the person is still a lead (link to `/leads/{lead_id}`)
            rather than a patient (link to `/customers/{id}`).
        lead_id:
          type:
            - integer
            - 'null'
          description: >-
            The lead the person came from; kept after conversion, so check
            `is_lead_stage` before linking to it.
      required:
        - id
        - record_state
        - first_name
        - last_name
        - phone_number
        - email
        - is_masked
        - is_lead_stage
        - lead_id
      title: RelatedCustomerResource
    RelatedUserResource:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        avatar_url:
          type:
            - string
            - 'null'
          description: >-
            A signed profile photo URL valid for a few hours, or `null` without
            a photo. Only on responses that opt in.
      required:
        - id
        - name
      title: RelatedUserResource
    RelatedCurrencyResource:
      type: object
      properties:
        id:
          type: integer
        code:
          type:
            - string
            - 'null'
        symbol:
          type:
            - string
            - 'null'
        name:
          type: string
      required:
        - id
        - code
        - symbol
        - name
      title: RelatedCurrencyResource
    OfferItemResource:
      type: object
      properties:
        id:
          type: integer
        offer_id:
          type: integer
        order:
          type: integer
        itemable_type:
          type:
            - string
            - 'null'
        itemable_id:
          type: integer
        quantity:
          type: number
        tax_rate:
          type: number
        unit_price:
          type: number
        discount_amount:
          type: number
        discount_percentage:
          type: number
        sub_total:
          type: number
        total_discount:
          type: number
        total_tax:
          type: number
        total_price:
          type: number
        itemable:
          anyOf:
            - $ref: '#/components/schemas/RelatedItemableResource'
            - type: 'null'
      required:
        - id
        - offer_id
        - order
        - itemable_type
        - itemable_id
        - quantity
        - tax_rate
        - unit_price
        - discount_amount
        - discount_percentage
        - sub_total
        - total_discount
        - total_tax
        - total_price
      title: OfferItemResource
    RelatedItemableResource:
      type: object
      properties:
        id:
          type: string
        name:
          type:
            - string
            - 'null'
      required:
        - id
        - name
      title: RelatedItemableResource
  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.