Shoplazza Discounts API

The Discounts API from Shoplazza — 14 operation(s) for discounts.

OpenAPI Specification

shoplazza-discounts-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: SPZ Admin Access Discounts API
  version: '2022.01'
servers:
- url: https://{subdomain}.myshoplaza.com
  variables:
    subdomain:
      default: developer
security:
- sec0: []
tags:
- name: Discounts
  description: ''
paths:
  /openapi/2022-01/price_rules:
    get:
      tags:
      - Discounts
      summary: Price Rule List
      description: ''
      operationId: price-rule-list
      parameters:
      - name: limit
        in: query
        description: 'Result per page, max: `250`'
        schema:
          type: integer
          format: int32
          default: 50
      - name: starts_at_min
        in: query
        description: Filter price rule started after date, timestamp format, e.g. `1581152471`
        schema:
          type: integer
          format: int32
      - name: starts_at_max
        in: query
        description: Filter price rule started before date, timestamp format, e.g. `1581152471`
        schema:
          type: integer
          format: int32
      - name: ends_at_min
        in: query
        description: Filter price rule ended before date, timestamp format, e.g. `1581152471`
        schema:
          type: integer
          format: int32
      - name: ends_at_max
        in: query
        description: Filter price rule ended after date, timestamp format, e.g. `1581152471`
        schema:
          type: integer
          format: int32
      - name: times_used
        in: query
        description: Used count for this price rule
        schema:
          type: integer
          format: int32
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"price_rules\": [\n        {\n            \"id\": \"91f9a466-7c8c-46e7-9774-64874a641534\",\n            \"title\": \"Buy $180 get $20 off,once for one customer\",\n            \"value\": 20,\n            \"value_type\": \"fixed_amount\",\n            \"usage_limit\": \"-1\",\n            \"times_used\": \"0\",\n            \"allocation_method\": \"\",\n            \"allocation_limit\": \"0\",\n            \"once_per_customer\": \"1\",\n            \"prerequisite\": \"1\",\n            \"customer_selection\": \"all\",\n            \"target_selection\": \"all\",\n            \"target_type\": \"\",\n            \"created_at\": \"2022-06-17 15:00:03\",\n            \"updated_at\": \"2022-06-17 15:00:03\",\n            \"starts_at\": \"1655431200\",\n            \"ends_at\": \"-1\",\n            \"entitled_product_ids\": [],\n            \"entitled_filter_ids\": [],\n            \"entitled_filter_list\": [],\n            \"variant_product_ids\": [],\n            \"prerequisite_subtotal_range\": [\n                {\n                    \"greater_than_or_equal_to\": \"180\",\n                    \"value\": \"20\",\n                    \"value_condition\": \"less_than_or_equal_to\",\n                    \"target_type\": \"\",\n                    \"target_data\": [],\n                    \"target_data_variant\": [],\n                    \"target_data_collection\": []\n                }\n            ],\n            \"prerequisite_quantity_range\": null\n        },\n        {\n            \"id\": \"b2bc789e-4f27-4dac-8a9e-7eab140a7281\",\n            \"title\": \"$20 off for all products, no conditions, used up to 100 times\",\n            \"value\": 20,\n            \"value_type\": \"fixed_amount\",\n            \"usage_limit\": \"100\",\n            \"times_used\": \"0\",\n            \"allocation_method\": \"\",\n            \"allocation_limit\": \"0\",\n            \"once_per_customer\": \"0\",\n            \"prerequisite\": \"0\",\n            \"customer_selection\": \"all\",\n            \"target_selection\": \"all\",\n            \"target_type\": \"\",\n            \"created_at\": \"2022-06-17 15:00:02\",\n            \"updated_at\": \"2022-06-17 15:00:02\",\n            \"starts_at\": \"1655431200\",\n            \"ends_at\": \"-1\",\n            \"entitled_product_ids\": [],\n            \"entitled_filter_ids\": [],\n            \"entitled_filter_list\": [],\n            \"variant_product_ids\": []\n        }\n    ]\n}"
              schema:
                type: object
                properties:
                  price_rules:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          example: 91f9a466-7c8c-46e7-9774-64874a641534
                        title:
                          type: string
                          example: Buy $180 get $20 off,once for one customer
                        value:
                          type: integer
                          example: 20
                          default: 0
                        value_type:
                          type: string
                          example: fixed_amount
                        usage_limit:
                          type: string
                          example: '-1'
                        times_used:
                          type: string
                          example: '0'
                        allocation_method:
                          type: string
                          example: ''
                        allocation_limit:
                          type: string
                          example: '0'
                        once_per_customer:
                          type: string
                          example: '1'
                        prerequisite:
                          type: string
                          example: '1'
                        customer_selection:
                          type: string
                          example: all
                        target_selection:
                          type: string
                          example: all
                        target_type:
                          type: string
                          example: ''
                        created_at:
                          type: string
                          example: '2022-06-17 15:00:03'
                        updated_at:
                          type: string
                          example: '2022-06-17 15:00:03'
                        starts_at:
                          type: string
                          example: '1655431200'
                        ends_at:
                          type: string
                          example: '-1'
                        entitled_product_ids:
                          type: array
                        entitled_filter_ids:
                          type: array
                        entitled_filter_list:
                          type: array
                        variant_product_ids:
                          type: array
                        prerequisite_subtotal_range:
                          type: array
                          items:
                            type: object
                            properties:
                              greater_than_or_equal_to:
                                type: string
                                example: '180'
                              value:
                                type: string
                                example: '20'
                              value_condition:
                                type: string
                                example: less_than_or_equal_to
                              target_type:
                                type: string
                                example: ''
                              target_data:
                                type: array
                              target_data_variant:
                                type: array
                              target_data_collection:
                                type: array
                        prerequisite_quantity_range: {}
      deprecated: false
    post:
      tags:
      - Discounts
      summary: Create Price Rule
      description: ''
      operationId: create-price-rule
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                price_rule:
                  type: object
                  required:
                  - title
                  - value
                  - value_type
                  - target_selection
                  - starts_at
                  - ends_at
                  properties:
                    title:
                      type: string
                      description: Title of this price rule
                    value:
                      type: number
                      description: Value for this discount , e.g. `50.25`
                      format: double
                    value_type:
                      type: string
                      description: 'Discount type, options: 1. `fixed_amount` for fixed amount of value to be reduced,  2. `percentage` for percentage of the value to be reduced'
                    usage_limit:
                      type: integer
                      description: The usage limit, `-1` means no limit
                      format: int32
                    allocation_limit:
                      type: integer
                      description: 'Redeem count limit for checkout: `0~999`, `0` means only one redeem allowed, `999` means no limit'
                      default: 0
                      format: int32
                    once_per_customer:
                      type: integer
                      description: The max usage per customer,`-1` or `0` means no limit
                      format: int32
                    prerequisite:
                      type: integer
                      description: Does this discount has prerequisite or not, `1` means yes, `0` means no
                      default: 1
                      format: int32
                    target_selection:
                      type: string
                      description: The target products allowed of this discount, `all` means all products, `entitled` means only for the specific products
                    target_type:
                      type: string
                      description: 'Target type of this discount, for example: `line_item`, `shipping_line`'
                      default: line_item
                    starts_at:
                      type: string
                      description: Discount started at
                    ends_at:
                      type: string
                      description: Discount ended at, `-1` means no limit
                    entitled_product_ids:
                      type: array
                      description: Specify the target products allowed for the price rule. This field is **required** only when `target_selection` is `entitled`, e.g. `[   "ac8ed089-55d9-4f58-a0f9-3dda4e4607cc",   "0b76afba-e068-4bf6-85f5-660019f58488" ]`
                      items:
                        type: string
                    entitled_variant_ids:
                      type: array
                      description: Specify the variants products allowed of the discount, e.g. `[   "cea210d5-a419-4d4e-a17d-5bbd0bc4af76",   "de2c55f5-c3e1-45e1-92f6-e65faf816ecc" ]`
                      items:
                        type: string
                    entitled_collection_ids:
                      type: array
                      description: Specify the collections allowed of the discount, e.g. `["aa92c677-e5be-4cab-8e65-9ebc55b98240","e6152ca6-791b-4385-a9e1-49adb336b289"]`
                      items:
                        type: string
                    prerequisite_subtotal_range:
                      type: array
                      description: 'Prerequisite for the total amount of the money, for example: `[   {     "greater_than_or_equal_to": "10",     "value": "1",     "target_type": "",     "target_data": []   } ] means total money must great than 10, then you could use the discount to reduce 1 dollar.`'
                      items:
                        properties:
                          greater_than_or_equal_to:
                            type: string
                            description: To specify the value which the price has to greater than or equal to.
                          value:
                            type: string
                            description: The value used for the discount to apply, the reduction type is decided by `value_type` specified in `Price Rule` params
                          target_type:
                            type: string
                            description: Target type
                          target_data:
                            type: array
                            description: Target data
                            default: []
                            items:
                              type: string
                        type: object
                    prerequisite_quantity_range:
                      type: array
                      description: Prerequisite for the total count of the products,e.g. `[   {     "greater_than_or_equal_to":"5",     "value":"20",     "target_type":"",     "target_data":[]   } ] means products count must great than 5, then you could use discount to reduce 20 dollars`
                      items:
                        properties:
                          greater_than_or_equal_to:
                            type: string
                            description: To specify the value which the price has to greater than or equal to.
                          value:
                            type: string
                            description: The value used for the discount to apply, the reduction type is decided by `value_type` specified in `Price Rule` params
                          target_type:
                            type: string
                            description: Target type
                          target_data:
                            type: array
                            description: Target data
                            default: []
                            items:
                              type: string
                        type: object
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"price_rule\": {\n        \"id\": \"2d7e416a-444f-4491-ae04-c50f47154140\",\n        \"title\": \"TITLE\",\n        \"value\": 0,\n        \"value_type\": \"percentage\",\n        \"usage_limit\": \"-1\",\n        \"times_used\": \"0\", \n        \"allocation_method\": \"\",\n        \"allocation_limit\": \"0\",\n        \"once_per_customer\": \"1\",\n        \"prerequisite\": \"1\",\n        \"customer_selection\": \"all\",\n        \"target_selection\": \"entitled\",\n        \"target_type\": \"\",\n        \"created_at\": \"2020-03-06 17:00:32\",\n        \"updated_at\": \"2020-03-12 15:29:44\",\n        \"starts_at\": \"1583424000\",\n        \"ends_at\": \"1583942399\",\n        \"entitled_product_ids\": [\n            \"cea210d5-a419-4d4e-a17d-5bbd0bc4af76\",\n            \"de2c55f5-c3e1-45e1-92f6-e65faf816ecc\",\n            \"47734e19-1b5c-468b-8695-31159d6d4478\"\n        ],\n        \"entitled_variant_ids\": [],\n        \"prerequisite_quantity_range\": [\n            {\n                \"greater_than_or_equal_to\": \"1\",\n                \"value\": \"5\",\n                \"target_type\": \"\",\n                \"target_data\": []\n            }\n        ],\n        \"prerequisite_subtotal_range\": null\n    }\n}"
              schema:
                type: object
                properties:
                  price_rule:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 2d7e416a-444f-4491-ae04-c50f47154140
                      title:
                        type: string
                        example: TITLE
                      value:
                        type: integer
                        example: 0
                        default: 0
                      value_type:
                        type: string
                        example: percentage
                      usage_limit:
                        type: string
                        example: '-1'
                      times_used:
                        type: string
                        example: '0'
                      allocation_method:
                        type: string
                        example: ''
                      allocation_limit:
                        type: string
                        example: '0'
                      once_per_customer:
                        type: string
                        example: '1'
                      prerequisite:
                        type: string
                        example: '1'
                      customer_selection:
                        type: string
                        example: all
                      target_selection:
                        type: string
                        example: entitled
                      target_type:
                        type: string
                        example: ''
                      created_at:
                        type: string
                        example: '2020-03-06 17:00:32'
                      updated_at:
                        type: string
                        example: '2020-03-12 15:29:44'
                      starts_at:
                        type: string
                        example: '1583424000'
                      ends_at:
                        type: string
                        example: '1583942399'
                      entitled_product_ids:
                        type: array
                        items:
                          type: string
                          example: cea210d5-a419-4d4e-a17d-5bbd0bc4af76
                      entitled_variant_ids:
                        type: array
                      prerequisite_quantity_range:
                        type: array
                        items:
                          type: object
                          properties:
                            greater_than_or_equal_to:
                              type: string
                              example: '1'
                            value:
                              type: string
                              example: '5'
                            target_type:
                              type: string
                              example: ''
                            target_data:
                              type: array
                      prerequisite_subtotal_range: {}
      deprecated: false
  /openapi/2022-01/price_rules/count:
    get:
      tags:
      - Discounts
      summary: Price Rule Count
      description: ''
      operationId: price-rule-count
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n  \"count\": \"398\"\n}"
              schema:
                type: object
                properties:
                  count:
                    type: string
                    example: '398'
      deprecated: false
  /openapi/2022-01/price_rules/{price_rule_id}:
    get:
      tags:
      - Discounts
      summary: Price Rule Detail
      description: ''
      operationId: price-rule-detail
      parameters:
      - name: price_rule_id
        in: path
        description: Price rule ID
        schema:
          type: string
        required: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"price_rule\": {\n        \"id\": \"00095d6a-419d-4499-a497-f265fb2edaa5\",\n        \"title\": \"title-update\",\n        \"value\": 0,\n        \"value_type\": \"percentage\",\n        \"usage_limit\": \"-1\",\n        \"times_used\": \"0\",\n        \"allocation_method\": \"\",\n        \"allocation_limit\": \"0\",\n        \"once_per_customer\": \"1\",\n        \"prerequisite\": \"1\",\n        \"customer_selection\": \"all\",\n        \"target_selection\": \"entitled\",\n        \"target_type\": \"\",\n        \"created_at\": \"2020-03-06 17:00:32\",\n        \"updated_at\": \"2020-03-12 15:29:44\",\n        \"starts_at\": \"1583424000\",\n        \"ends_at\": \"1583942399\",\n        \"entitled_product_ids\": [\n            \"cea210d5-a419-4d4e-a17d-5bbd0bc4af76\",\n            \"de2c55f5-c3e1-45e1-92f6-e65faf816ecc\",\n            \"47734e19-1b5c-468b-8695-31159d6d4478\"\n        ],\n        \"entitled_variant_ids\": [],\n        \"prerequisite_quantity_range\": [\n            {\n                \"greater_than_or_equal_to\": \"1\",\n                \"value\": \"5\",\n                \"target_type\": \"\",\n                \"target_data\": []\n            }\n        ],\n        \"prerequisite_subtotal_range\": null\n    }\n}"
              schema:
                type: object
                properties:
                  price_rule:
                    type: object
                    properties:
                      id:
                        type: string
                        example: 00095d6a-419d-4499-a497-f265fb2edaa5
                      title:
                        type: string
                        example: title-update
                      value:
                        type: integer
                        example: 0
                        default: 0
                      value_type:
                        type: string
                        example: percentage
                      usage_limit:
                        type: string
                        example: '-1'
                      times_used:
                        type: string
                        example: '0'
                      allocation_method:
                        type: string
                        example: ''
                      allocation_limit:
                        type: string
                        example: '0'
                      once_per_customer:
                        type: string
                        example: '1'
                      prerequisite:
                        type: string
                        example: '1'
                      customer_selection:
                        type: string
                        example: all
                      target_selection:
                        type: string
                        example: entitled
                      target_type:
                        type: string
                        example: ''
                      created_at:
                        type: string
                        example: '2020-03-06 17:00:32'
                      updated_at:
                        type: string
                        example: '2020-03-12 15:29:44'
                      starts_at:
                        type: string
                        example: '1583424000'
                      ends_at:
                        type: string
                        example: '1583942399'
                      entitled_product_ids:
                        type: array
                        items:
                          type: string
                          example: cea210d5-a419-4d4e-a17d-5bbd0bc4af76
                      entitled_variant_ids:
                        type: array
                      prerequisite_quantity_range:
                        type: array
                        items:
                          type: object
                          properties:
                            greater_than_or_equal_to:
                              type: string
                              example: '1'
                            value:
                              type: string
                              example: '5'
                            target_type:
                              type: string
                              example: ''
                            target_data:
                              type: array
                      prerequisite_subtotal_range: {}
        '404':
          description: '404'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"errors\": [\n        \"Not found\"\n    ]\n}"
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: string
                      example: Not found
      deprecated: false
    put:
      tags:
      - Discounts
      summary: Update Price Rule
      description: ''
      operationId: update-price-rule
      parameters:
      - name: price_rule_id
        in: path
        description: Price rule ID
        schema:
          type: string
        required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                price_rule:
                  type: object
                  properties:
                    title:
                      type: string
                      description: Title of this price rule
                    value:
                      type: number
                      description: Value for this discount , e.g. `50.25`
                      format: double
                    value_type:
                      type: string
                      description: 'Discount type, options: 1. `fixed_amount` for fixed amount of value to be reduced,  2. `percentage` for percentage of the value to be reduced'
                    usage_limit:
                      type: integer
                      description: The usage limit, `-1` means no limit
                      format: int32
                    allocation_limit:
                      type: integer
                      description: 'Redeem count limit for checkout: `0~999`, `0` means only one redeem allowed, `999` means no limit'
                      format: int32
                    once_per_customer:
                      type: integer
                      description: The max usage per customer,`-1` or `0` means no limit
                      format: int32
                    prerequisite:
                      type: integer
                      description: Does this discount has prerequisite or not, `1` means yes, `0` means no
                      default: 1
                      format: int32
                    target_selection:
                      type: string
                      description: The target products allowed of this discount, `all` means all products, `entitled` means only for the specific products
                    target_type:
                      type: string
                      description: 'Target type of this discount, for example: `line_item`, `shipping_line`'
                    starts_at:
                      type: string
                      description: Discount started at
                    ends_at:
                      type: string
                      description: Discount ended at, `-1` means no limit
                    entitled_product_ids:
                      type: array
                      description: Specify the target products allowed for the price rule. This field is **required** only when `target_selection` is `entitled`, e.g. `[   "ac8ed089-55d9-4f58-a0f9-3dda4e4607cc",   "0b76afba-e068-4bf6-85f5-660019f58488" ]`
                      items:
                        type: string
                    entitled_variant_ids:
                      type: array
                      description: Specify the variants products allowed of the discount, e.g. `[   "cea210d5-a419-4d4e-a17d-5bbd0bc4af76",   "de2c55f5-c3e1-45e1-92f6-e65faf816ecc" ]`
                      items:
                        type: string
                    entitled_collection_ids:
                      type: array
                      description: Specify the collections allowed of the discount, e.g. `["aa92c677-e5be-4cab-8e65-9ebc55b98240","e6152ca6-791b-4385-a9e1-49adb336b289"]`
                      items:
                        type: string
                    prerequisite_subtotal_range:
                      type: array
                      description: 'Prerequisite for the total amount of the money, for example: `[   {     "greater_than_or_equal_to": "10",     "value": "1",     "target_type": "",     "target_data": []   } ] means total money must great than 10, then you could use the discount to reduce 1 dollar.`'
                      items:
                        properties:
                          greater_than_or_equal_to:
                            type: string
                            description: To specify the value which the price has to greater than or equal to.
                          value:
                            type: string
                            description: The value used for the discount to apply, the reduction type is decided by `value_type` specified in `Price Rule` params
                          target_type:
                            type: string
                            description: Target type
                          target_data:
                            type: array
                            description: Target data
                            default: []
                            items:
                              type: string
                        type: object
                    prerequisite_quantity_range:
                      type: array
                      description: Prerequisite for the total count of the products,e.g. `[   {     "greater_than_or_equal_to":"5",     "value":"20",     "target_type":"",     "target_data":[]   } ] means products count must great than 5, then you could use discount to reduce 20 dollars`
                      items:
                        properties:
                          greater_than_or_equal_to:
                            type: string
                            description: To specify the value which the price has to greater than or equal to.
                          value:
                            type: string
                            description: The value used for the discount to apply, the reduction type is decided by `value_type` specified in `Price Rule` params
                          target_type:
                            type: string
                            description: Target type
                          target_data:
                            type: array
                            description: Target data
                            default: []
                            items:
                              type: string
                        type: object
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"price_rule\": {\n        \"id\": \"00095d6a-419d-4499-a497-f265fb2edaa5\",\n        \"title\": \"title-update\",\n        \"value\": 0,\n        \"value_type\": \"percentage\",\n        \"usage_limit\": \"-1\",\n        \"times_used\": \"0\",\n        \"allocation_method\": \"\",\n        \"allocation_limit\": \"0\",\n        \"once_per_customer\": \"1\",\n        \"prerequisite\": \"1\",\n        \"customer_selection\": \"all\",\n        \"target_selection\": \"entitled\",\n        \"target_type\": \"\",\n        \"created_at\": \"2020-03-06 17:00:32\",\n        \"updated_at\": \"2020-03-12 15:29:44\",\n        \"starts_at\": \"1583424000\",\n        \"ends_at\": \"1583942399\",\n        \"entitled_product_ids\": [\n            \"cea210d5-a419-4d4e-a17d-5bbd0bc4af76\",\n            \"de2c55f5-c3e1-45e1-92f6-e65faf816ecc\",\n            \"47734e19-1b5c-468b-8695-31159d6d4478\"\n        ],\n        \"entitled_variant_ids\": [],\n        \"prerequisite_quantity_range\": [\n            {\n                \"greater_than_or_equal_to\": \"1\",\n                \"value\": \"5\",\n                \"target_type\": \"\",\n                \"target_data\": []\n            }\n        ],\n        \"prerequisite_subtotal_range\": n

# --- truncated at 32 KB (140 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/shoplazza/refs/heads/main/openapi/shoplazza-discounts-api-openapi.yml