openapi: 3.0.0
x-mint:
  mcp:
    enabled: true
info:
  title: Offers - Price methods
  description: >-
    fabric Offers is a holistic e-commerce solution enabling Merchants to
    execute a range of pricing strategies to increase their competitiveness in
    the market and set the right promotion, to the right customer through the
    most effective channel. Offers is a cornerstone capability that can be sold
    as part of the integrated suite or stand on its own as an industry leading
    Pricing and Promotion system for B2B and B2C. The controls and automation
    provided will drastically reduce operational overhead and ensure merchants
    can quickly react to their fast-changing environment.<p>fabric e-commerce
    Offers endpoints allow you to set up and manage stock keeping unit (SKU)
    prices. Its wide range of coupon and promotion features let you design deals
    ranging from single-use, customer-specific coupons to site-wide promotions.
  version: 3.0.0
  x-audience: external-public
  termsOfService: https://fabric.inc/terms-of-use
  contact:
    name: Offers support
    email: support@fabric.inc
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
externalDocs:
  description: Find out more about Offers
  url: https://developer.fabric.inc/docs/offers-overview
servers:
  - url: https://api.fabric.inc/v3
    description: Production environment
paths:
  /price-methods:
    get:
      tags:
        - Price Methods
      summary: Get all price methods
      description: Get a paginated list of all price methods of SKUs.
      operationId: getPriceMethods
      security:
        - AuthorizationToken: []
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
        - $ref: '#/components/parameters/queryParameterSize'
        - $ref: '#/components/parameters/queryParameterOffset'
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getPriceMethodsResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/badSizeError'
                  - $ref: '#/components/schemas/badSortingError'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
    post:
      tags:
        - Price Methods
      summary: Create price method
      description: >-
        Create a price method that you can use to set up the SKU price. Price
        method can be created based on SKU quantity, dimension of the SKU, or
        any other strategy that aligns with the business.
      operationId: createPriceMethods
      security:
        - AuthorizationToken: []
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/createPriceMethodRequest'
      responses:
        '201':
          description: Created
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/createPriceMethodResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/priceMethodNameExist'
                  - $ref: '#/components/schemas/priceMethodNameNotValid'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
  /price-methods/{id}:
    put:
      tags:
        - Price Methods
      summary: Update a specific price method
      description: Update a specific price method by ID.
      operationId: updatePriceMethods
      security:
        - AuthorizationToken: []
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
        - name: id
          in: path
          required: true
          description: Price method ID
          schema:
            type: integer
            format: int32
            example: 100009
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updatePriceMethodRequest'
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updatePriceMethodResponse'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/priceMethodNameNotValid'
                  - $ref: '#/components/schemas/priceMethodInvalidId'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '404':
          description: Not Found
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/priceMethodNotFound'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
    delete:
      tags:
        - Price Methods
      summary: Delete a specific price method
      description: Delete a specific price method by ID.
      operationId: deletePriceMethods
      security:
        - AuthorizationToken: []
      parameters:
        - $ref: '#/components/parameters/xFabricTenantId'
        - $ref: '#/components/parameters/xFabricChannelId'
        - $ref: '#/components/parameters/xClientId'
        - $ref: '#/components/parameters/xFabricRequestId'
        - name: id
          in: path
          required: true
          description: Price method ID
          schema:
            type: integer
            format: int32
            example: 100009
      responses:
        '200':
          description: OK
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/deletePriceMethodResponse'
              example:
                id: 63807
                name: QUANTITY_PRICING
                isDeleted: true
                createdAt: '2019-08-20T14:15:22Z'
                updatedAt: '2019-08-20T14:15:22Z'
        '400':
          description: Bad request
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/priceMethodInvalidId'
                  - $ref: '#/components/schemas/missingTenantHeader'
                  - $ref: '#/components/schemas/error400'
        '401':
          description: Unauthorized
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error401'
        '404':
          description: Not found
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/priceMethodNotFound'
        '500':
          description: Internal server error
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/xFabricRequestIdResponse'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error500'
components:
  securitySchemes:
    AuthorizationToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
  schemas:
    missingTenantHeader:
      type: object
      description: Tenant header is missing
      properties:
        type:
          description: The error code.
          type: string
          example: TENANT_HEADER_REQUIRED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: x-fabric-tenant-id header is required
    error400:
      type: object
      description: Bad request error
      properties:
        type:
          description: The error code.
          type: string
          example: BAD_REQUEST
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Bad request
    error401:
      type: object
      description: Unauthorized error
      properties:
        type:
          description: The error code.
          type: string
          example: UNAUTHORIZED
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Invalid credentials
    error500:
      type: object
      description: Internal server error
      properties:
        type:
          description: The error code.
          type: string
          example: INTERNAL_SERVER_ERROR
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Internal server error
    createdAt:
      type: string
      format: date-time
      description: Record's creation time
      example: 2019-08-20T14:15:22.000Z
    updatedAt:
      type: string
      format: date-time
      description: Record's last updated time
      example: 2019-08-20T14:15:22.000Z
    isDeleted:
      type: boolean
      description: 'true: Record is deleted<br>false: Record isn''t deleted'
      example: false
    offsetQuery:
      type: object
      description: Provides pagination data.
      properties:
        size:
          type: integer
          format: int32
          example: 10
          minimum: 1
          maximum: 100
          default: 10
          description: The maximum number of records per page.
        offset:
          type: integer
          format: int32
          example: 10
          minimum: 0
          default: 0
          description: >-
            The number of records to skip before returning records. For example,
            with an offset of 20 and limit of 10, you will get records from 21
            to 30.
        count:
          type: integer
          format: int32
          example: 50
          description: The total number of available records.
    badSizeError:
      type: object
      description: Pagination size error, an invalid value was sent
      properties:
        type:
          description: The error code.
          type: string
          example: REQUEST_VALIDATION
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Size should be a valid number
    badSortingError:
      type: object
      description: Invalid sorting values sent
      properties:
        type:
          description: The error code.
          type: string
          example: REQUEST_VALIDATION
        message:
          description: >-
            An error message corresponding to the `type`. In this case. an
            invalid sorting value was sent.
          type: string
          example: Sorting value must be one of the allowed values
    priceMethod:
      type: object
      description: Price method record detail
      required:
        - id
        - name
        - createdAt
        - updatedAt
        - isDeleted
      properties:
        id:
          type: integer
          format: int32
          description: The ID of price method.
          example: 63807
        name:
          type: string
          description: The name of the price method.
          example: QUANTITY_PRICING
        createdAt:
          $ref: '#/components/schemas/createdAt'
        updatedAt:
          $ref: '#/components/schemas/updatedAt'
        isDeleted:
          $ref: '#/components/schemas/isDeleted'
    priceMethodRequest:
      type: object
      description: A sample request to create price method.
      required:
        - name
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 120
          description: The name of the price method.
          example: QUANTITY_PRICING
          enum:
            - QUANTITY_PRICING
            - SQUARE_AREA_PRICING
            - TABLE_PRICING_LENGTH_WIDTH
    getPriceMethodsResponse:
      type: object
      description: A paginated response of price methods.
      properties:
        query:
          $ref: '#/components/schemas/offsetQuery'
        data:
          description: Price method list
          type: array
          items:
            $ref: '#/components/schemas/priceMethod'
    createPriceMethodResponse:
      $ref: '#/components/schemas/priceMethod'
    updatePriceMethodResponse:
      $ref: '#/components/schemas/priceMethod'
    deletePriceMethodResponse:
      $ref: '#/components/schemas/priceMethod'
    createPriceMethodRequest:
      $ref: '#/components/schemas/priceMethodRequest'
    updatePriceMethodRequest:
      $ref: '#/components/schemas/priceMethodRequest'
    priceMethodNameExist:
      type: object
      description: Duplicated price method name error
      properties:
        type:
          description: The error code.
          type: string
          example: PRICEMETHOD_NAME_EXISTS
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Price method name already exists
    priceMethodNameNotValid:
      type: object
      description: Invalid price method ID
      properties:
        type:
          description: The error code.
          type: string
          example: PRICEMETHOD_NAME_VALUE_CANNOT_BE_EMPTY
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: Price method name can't be empty
    priceMethodNotFound:
      type: object
      description: Price method not found error
      properties:
        type:
          description: The error code.
          type: string
          example: PRICEMETHOD_NOT_FOUND
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: No price method with this ID found
    priceMethodInvalidId:
      type: object
      description: Price method invalid ID error
      properties:
        type:
          description: The error code.
          type: string
          example: PRICEMETHOD_ID_NOT_VALID
        message:
          description: An error message corresponding to the `type`.
          type: string
          example: The price method ID isn't valid, it must be a valid price method ID
  parameters:
    xFabricTenantId:
      in: header
      name: x-fabric-tenant-id
      schema:
        type: string
        minLength: 24
        maxLength: 24
      required: true
      example: 5f328bf0b5f328bf0b5f328b
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
    xFabricChannelId:
      in: header
      name: x-fabric-channel-id
      schema:
        type: string
        example: '12'
      description: >-
        x-fabric-channel-id identifies the sales channel where the API request
        is being made; primarily for multichannel use cases. The channel ids are
        12 corresponding to US and 13 corresponding to Canada. The default
        channel id is 12. This field is required.
    xClientId:
      in: header
      name: x-client-id
      schema:
        type: string
      required: false
      example: copilot
      description: >-
        A unique identifier obtained from
        [Copilot](/v3/platform/settings/api-apps/getting-system-app-credentials)
        for the System app in the fabric ecosystem, essential for OpenID Connect
        authentication flows.
    xFabricRequestId:
      in: header
      name: x-fabric-request-id
      description: A unique request ID.
      required: false
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
    queryParameterSize:
      name: size
      in: query
      description: The maximum number of records per page.
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
        default: 10
        maximum: 100
    queryParameterOffset:
      name: offset
      in: query
      description: >-
        The number of records to skip before returning records. For example,
        with an offset of 20 and limit of 10, you will get records from 21 to
        30.
      required: false
      schema:
        type: integer
        format: int32
        minimum: 0
        example: 0
        default: 0
  headers:
    xFabricRequestIdResponse:
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
