Keap Category Discounts API

Keap Category Discounts API — 7 operations across 4 paths on the Keap REST v2 contract, read from Keap's own published OpenAPI 3.1 document.

OpenAPI Specification

keap-category-discounts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Keap Category Discounts API
  description: Keap Public API Documentation
  termsOfService: https://www.thryv.com/terms-of-use
  contact:
    name: Keap
    url: https://developer.keap.com/get-support
    email: api.keap@thryv.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: v2
servers:
- url: https://api.infusionsoft.com/crm
tags:
- name: Category Discounts
paths:
  /rest/v2/discounts/productCategories:
    get:
      tags:
      - Category Discounts
      summary: List Category Discounts
      description: Retrieves a list of Category Discounts
      operationId: listCategoryDiscounts
      parameters:
      - name: filter
        in: query
        description: 'Filter to apply, the allowed field is:

          - (String) `id` - Allowable operators: "==","<=", "<", ">=", ">", "!="

          - (List[String]) `ids`

          - (String) `name` - Wildcard matching allowed

          - (String) `description` - Wildcard matching allowed

          - (String) `product_category_id`


          You will need to apply the `==` operator to check the equality of the filter with your searched

          word, in the encoded form `%3D%3D`. For the filters listed above, here are some examples:

          - `filter=product_category_id%3D%3D4`

          - `filter=ids%3D%3D1,10,4,24`

          - `filter=id%3E5`


          For fields which allow wildcard matching, you may use the * wildcard character (or its encoded
          form %2A)

          for case-insensitive partial matching on text fields. Example of a valid pattern of wildcard
          usage:

          - `description==foo*` finds anything in `description` that begins with `foo`


          '
        required: false
        schema:
          type: string
      - name: page_token
        in: query
        description: Page token
        required: false
        schema:
          type: string
      - name: order_by
        in: query
        description: 'Attribute and direction to order items.

          One of the following fields:

          - `id`

          - `name`


          One of the following directions:

          - `asc`

          - `desc`'
        required: false
        schema:
          type: string
      - name: page_size
        in: query
        description: Total number of items to return per page
        required: false
        schema:
          type: integer
          format: int32
          maximum: 1000
          minimum: 0
        example: 0
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListCategoryDiscountsResponse'
    post:
      tags:
      - Category Discounts
      summary: Create a Category Discount
      description: Creates a Category Discount
      operationId: createCategoryDiscount
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCategoryDiscountRequest'
        required: true
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryDiscount'
  /rest/v2/discounts/productCategories/{discount_id}/criteria:
    post:
      tags:
      - Category Discounts
      summary: Create a Category Discount Criteria
      description: Creates a Category Discount Criteria
      operationId: createCategoryDiscountCriteria
      parameters:
      - name: discount_id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCategoryDiscountCriteria'
        required: true
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DiscountCriteria'
  /rest/v2/discounts/productCategories/{discount_id}:
    get:
      tags:
      - Category Discounts
      summary: Retrieve a Category Discount
      description: Retrieves a single Category Discount
      operationId: getCategoryDiscount
      parameters:
      - name: discount_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryDiscount'
    delete:
      tags:
      - Category Discounts
      summary: Delete a Category Discount
      description: Deletes a specified Category Discount
      operationId: deleteCategoryDiscount
      parameters:
      - name: discount_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '204':
          description: No Content
    patch:
      tags:
      - Category Discounts
      summary: Update a Category Discount
      description: Updates a Category Discount
      operationId: updateCategoryDiscount
      parameters:
      - name: discount_id
        in: path
        required: true
        schema:
          type: string
      - name: update_mask
        in: query
        description: An optional list of properties to be updated. If set, only the provided properties
          will be updated and others will be skipped.
        required: false
        schema:
          type: array
          items:
            type: string
            enum:
            - name
            - description
            - discount_percent
            - apply_to_commissions
            - criteria
            - product_category_ids
          uniqueItems: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateCategoryDiscountRequest'
        required: true
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CategoryDiscount'
  /rest/v2/discounts/productCategories/{discount_id}/criteria/{criteria_id}:
    delete:
      tags:
      - Category Discounts
      summary: Delete a Category Discount Criteria
      description: Deletes a specified Category Discount Criteria
      operationId: deleteCategoryDiscountCriteria
      parameters:
      - name: discount_id
        in: path
        required: true
        schema:
          type: string
      - name: criteria_id
        in: path
        required: true
        schema:
          type: string
      responses:
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '501':
          description: Method Not Implemented
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '405':
          description: Method Not Allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '204':
          description: No Content
components:
  schemas:
    CategoryDiscount:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for this category discount
          example: 102
        name:
          type: string
          description: Name of the discount
          example: Electronics Category Sale
        description:
          type: string
          description: Description of the discount
          example: 15% off all electronics
        criteria:
          type: array
          description: List of criteria that must be met for this discount to apply
          items:
            $ref: '#/components/schemas/CategoryDiscountCriteriaResponse'
        discount_percent:
          type: number
          format: double
          description: Percentage discount to apply (0-100)
          example: 15.0
        apply_to_commissions:
          type: boolean
          description: Whether to apply this discount to commission calculations
          example: false
        product_categories:
          type: array
          description: List of product category IDs this discount applies to
          example:
          - '10'
          - '11'
          - '12'
          items:
            type: string
    CategoryDiscountCriteriaRequest:
      type: object
      properties:
        type:
          type: string
          description: 'Type of criteria: DATE_RANGE or PROMO_CODE'
          enum:
          - DATE_RANGE
          - PROMO_CODE
          example: DATE_RANGE
        code:
          type: string
          description: Promotional code for PROMO_CODE criteria
          example: SUMMER2024
        range_start_time:
          type: string
          format: date-time
          description: Start date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-01-01T00:00:00Z'
        range_end_time:
          type: string
          format: date-time
          description: End date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-12-31T23:59:59Z'
    CategoryDiscountCriteriaResponse:
      type: object
      properties:
        type:
          type: string
          description: 'Type of criteria: DATE_RANGE or PROMO_CODE'
          enum:
          - DATE_RANGE
          - PROMO_CODE
          example: DATE_RANGE
        code:
          type: string
          description: Promotional code for PROMO_CODE criteria
          example: SUMMER2024
        criteria_id:
          type: string
          description: Unique identifier for this criteria
          example: 501
        range_start_time:
          type: string
          format: date-time
          description: Start date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-01-01T00:00:00Z'
        range_end_time:
          type: string
          format: date-time
          description: End date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-12-31T23:59:59Z'
    CreateCategoryDiscountCriteria:
      type: object
      properties:
        type:
          type: string
          description: 'Type of criteria: DATE_RANGE or PROMO_CODE'
          enum:
          - DATE_RANGE
          - PROMO_CODE
          example: DATE_RANGE
        code:
          type: string
          description: Promotional code for PROMO_CODE criteria
          example: SUMMER2024
        range_start_time:
          type: string
          format: date-time
          description: Start date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-01-01T00:00:00Z'
        range_end_time:
          type: string
          format: date-time
          description: End date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-12-31T23:59:59Z'
    CreateCategoryDiscountRequest:
      type: object
      properties:
        name:
          type: string
          description: Name of the discount
          example: Electronics Category Sale
        description:
          type: string
          description: Description of the discount
          example: 15% off all electronics
        criteria:
          type: array
          description: List of criteria that must be met for this discount to apply
          items:
            $ref: '#/components/schemas/CategoryDiscountCriteriaRequest'
        apply_to_commissions:
          type: boolean
          description: Whether to apply this discount to commission calculations
          example: false
        discount_percent:
          type: number
          format: double
          description: Percentage discount to apply. Must be greater than or equal to 0.
          example: 15.0
        product_category_ids:
          type: array
          description: List of product category IDs this discount applies to
          example:
          - '10'
          - '11'
          - '12'
          items:
            type: string
      required:
      - apply_to_commissions
      - discount_percent
      - name
      - product_category_ids
    DiscountCriteria:
      type: object
      properties:
        type:
          type: string
          description: 'Type of criteria: DATE_RANGE, PROMO_CODE, PRODUCT, SUBSCRIPTION_PLAN, or ORDER_TOTAL'
          enum:
          - DATE_RANGE
          - PROMO_CODE
          - PRODUCT
          - SUBSCRIPTION_PLAN
          - ORDER_TOTAL
          example: DATE_RANGE
        code:
          type: string
          description: Promotional code for PROMO_CODE criteria
          example: SUMMER2024
        criteria_id:
          type: string
          description: Unique identifier for this criteria
          example: 501
        range_start_time:
          type: string
          format: date-time
          description: Start date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-01-01T00:00:00Z'
        range_end_time:
          type: string
          format: date-time
          description: End date/time for DATE_RANGE criteria (ISO-8601 format)
          example: '2024-12-31T23:59:59Z'
        product_id:
          type: string
          description: Product ID for PRODUCT criteria
          example: 456
        product_quantity_min:
          type: integer
          format: int32
          description: Minimum product quantity for PRODUCT criteria
          example: 1
        product_quantity_max:
          type: integer
          format: int32
          description: Maximum product quantity for PRODUCT criteria
          example: 10
        plan_id:
          type: string
          description: Subscription plan ID for SUBSCRIPTION_PLAN criteria
          example: 789
        subscription_quantity:
          type: integer
          format: int32
          description: Subscription quantity for SUBSCRIPTION_PLAN criteria
          example: 1
        total_amount:
          type: number
          format: double
          description: Total amount threshold for ORDER_TOTAL criteria
          example: 100.0
        operator:
          type: string
          description: 'Comparison operator for ORDER_TOTAL criteria: LESS_THAN or GREATER_THAN'
          enum:
          - LESS_THAN
          - GREATER_THAN
          example: GREATER_THAN
    Error:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        status:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
    ErrorDetails:
      type: object
      properties:
        domain:
          type: string
        resource:
          type: string
    ListCategoryDiscountsResponse:
      type: object
      properties:
        discounts:
          type: array
          items:
            $ref: '#/components/schemas/CategoryDiscount'
        next_page_token:
          type: string
    UpdateCategoryDiscountRequest:
      type: object
      properties:
        name:
          type: string
          description: Name of the discount
          example: Electronics Category Sale
        description:
          type: string
          description: Description of the discount
          example: 15% off all electronics
        criteria:
          type: array
          description: List of criteria that must be met for this discount to apply
          items:
            $ref: '#/components/schemas/CategoryDiscountCriteriaRequest'
        apply_to_commissions:
          type: boolean
          description: Whether to apply this discount to commission calculations
          example: false
        discount_percent:
          type: number
          format: double
          description: Percentage discount to apply. Must be greater than or equal to 0.
          example: 15.0
        product_category_ids:
          type: array
          description: List of product category IDs this discount applies to
          example:
          - '10'
          - '11'
          - '12'
          items:
            type: string
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.infusionsoft.com/app/oauth/authorize
          tokenUrl: https://api.infusionsoft.com/token
          scopes: {}
security:
- oauth2: []