> ## Documentation Index
> Fetch the complete documentation index at: https://help.lobyco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload product filter

> Uploads a file for the specified bonus campaign and updates the campaign's associated file reference based on the specified CampaignFileType.
Supported file types vary depending on the BonusType of the campaign. Upload will fail if the selected fileType is not 
compatible with the campaign's bonus type.


Supported files types for bonus types: 

1. ProductBonus: Percentage, FixedPrice 

2. BasketBonus: ExcludedProductIds, ExcludedCategories 

3. LocalBonus: ProductIds, ExcludedCategories



## OpenAPI

````yaml openapi/bonus-calculation-v1.json POST /v1/campaigns/{id}/files/{fileType}
openapi: 3.0.4
info:
  title: BonusCalculation.Api
  version: v1
servers:
  - url: https://{host}/bonus-calculation
    description: Your Lobyco environment
    variables:
      host:
        default: your-environment.lobyco.net
        description: >-
          The API host for your Lobyco environment. Replace it with the host you
          were given — this placeholder does not resolve.
security:
  - Bearer: []
paths:
  /v1/campaigns/{id}/files/{fileType}:
    post:
      tags:
        - Service2Service
      summary: Upload product filter
      description: >-
        Uploads a file for the specified bonus campaign and updates the
        campaign's associated file reference based on the specified
        CampaignFileType.

        Supported file types vary depending on the BonusType of the campaign.
        Upload will fail if the selected fileType is not 

        compatible with the campaign's bonus type.



        Supported files types for bonus types: 


        1. ProductBonus: Percentage, FixedPrice 


        2. BasketBonus: ExcludedProductIds, ExcludedCategories 


        3. LocalBonus: ProductIds, ExcludedCategories
      parameters:
        - name: id
          in: path
          description: The identifier of the bonus campaign.
          required: true
          schema:
            type: integer
            format: int64
        - name: fileType
          in: path
          description: >-
            The type of the file being uploaded. Determines which property on
            the campaign should be updated.

            Defaults to Percentage if not specified.
          required: true
          schema:
            $ref: >-
              #/components/schemas/BonusCalculation.Domain.Entities.CampaignFileType
      requestBody:
        content:
          multipart/form-data:
            schema:
              required:
                - formFile
              type: object
              properties:
                formFile:
                  type: string
                  description: >-
                    The file to be uploaded. Must be provided in the
                    multipart/form-data body.
                  format: binary
            encoding:
              formFile:
                style: form
      responses:
        '200':
          description: File uploaded successfully and campaign updated.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BonusCalculation.Api.CQRS.Commands.UploadBonusCampaignFile_Response
        '400':
          description: |-
            Invalid request. This could be due to:
            - Missing or malformed form data
            - Campaign not found
            - Unsupported file type for the campaign's bonus type
            - File upload or campaign update failed during processing
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/LoopFoundation.Commons.Contracts.WebServiceError
components:
  schemas:
    BonusCalculation.Domain.Entities.CampaignFileType:
      enum:
        - Percentage
        - FixedPrice
        - CampaignPercentage
        - Custom
        - ProductIds
        - ExcludedCategories
        - MemberIds
        - ExcludedProductIds
      type: string
    BonusCalculation.Api.CQRS.Commands.UploadBonusCampaignFile_Response:
      type: object
      properties:
        id:
          type: string
          nullable: true
      additionalProperties: false
    LoopFoundation.Commons.Contracts.WebServiceError:
      required:
        - message
        - name
      type: object
      properties:
        name:
          minLength: 1
          type: string
        message:
          minLength: 1
          type: string
        details:
          nullable: true
      additionalProperties: false
  securitySchemes:
    Bearer:
      type: apiKey
      description: >-
        JWT Authorization header using the Bearer scheme. Example:
        "Authorization: Bearer {token}"
      name: Authorization
      in: header

````