Public APIs for Quantity Breaks (QB)

How to get the access key

After you install B2B/Wholesale Solution Shopify app. Go to Public API page, click on the Copy button.

Rule endpoints

There are fields of rule, you need to understand: - priority: decides whether a rule is prioritized over another or not. - status:
0: inactive
1: active
- apply_to:
0: All customers
1: Logged-in customers
2: Not-logged-in customers
3: Specific customers
4: Customer tags
- exclude_customer:
0: None
1: Customer tags
2: Specific customers
- product_condition_type:
0: All products
1: Specific products
2: Product collections
3: Product tags
- rule_setting:
0: Quantity break
1: Amount break
- qb_table_type:
0: Full range & Discounts
1: Full range & Discounted prices
2: From & Discounts
3: From & Discounted prices 1
4: From & Discounted prices 2
5: From & Discounts with Discounted prices 1
6: From & Discounts with Discounted prices 2
7: Legacy 1
8: Legacy 2
Note:
When request get rules by domain or ID, the rule_setting field will appear at the response to inform you whether your rule is Quantity Break or Amount Break.
However, when send request Create/Update rule the rule_setting will be Quantity Break by default as we haven't support create/update Amount Break as of date.
- qty_table: Quantity settings of rule + rule_type:
0: Minimum Product Qty
1: Minimum Order Qty
2: Minimum Variant Qty
- Minimum Product Qty:
If one order contains the selected products and the number of each product meets the quantity break ranges, the price of the product will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. The total quantity of A is 9 so the price of A will be discounted by 15%. The price of B, however, will be discounted by 10%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
- Minimum Order Qty:
If one order contains the selected products and the total number of those products meets the quantity break ranges, they will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%) and from 11 to 20 (discount 20%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. The total quantity of A and B is 13, meaning that the prices of A and B will be discounted by 20%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
- Minimum Variant Qty :
If one order contains the selected products and the number of variants meets the quantity break ranges, the price of those variants will be discounted accordingly.
For example:
You choose products A and B to apply the quantity break rule. A has two variants: A1, A2. B also has two variants B1, B2.
The order quantity break ranges are from 0 to 5 (discounted 10%) and from 6 to 10 (discount 15%) and from 11 to 20 (discount 20%)
That time, if the customer buys 3 A1, 6 A2 and 4 B1. Then, the prices of A1 and B1 will be discounted by 10% and that of A2 will be discounted by 15%.
If the quantity of the order/product(s)/variant(s) is not within the ranges, the original prices are applied.
+ qty_from: The order quantity break ranges are from qty_from to qty_to + qty_to: The order quantity break ranges are from qty_from to qty_to + discount_type:
0: Apply a price to selected products
1: Decrease a fixed amount of the original prices of selected products
2: Decrease the original prices of selected products by a percentage (%)

Get Rules by Domain

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-by-domain Method: POST Content-type: application/json Request body:
domain: your default Shopify store domain.
accessKey: value of access key.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body:
{
"success": true,
"rules": [
{
"id": 9792,
"shop_id": 9204,
"name": "sencond1",
"priority": 0,
"rule_type": 2,
"rule_setting": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"published_at": null,
"unpublished_at": null,
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"qb_table_type": 3,
"createdAt": "2023-03-09T02:27:26.000Z",
"updatedAt": "2023-05-30T04:29:18.000Z",
"qbRuleQtyTables": [
{
"id": 33022,
"rule_id": 9792,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33023,
"rule_id": 9792,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"abRuleQtyTables": []
},
{
"id": 9909,
"shop_id": 9204,
"name": "sencond2",
"priority": 0,
"rule_type": 2,
"rule_setting": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"published_at": null,
"unpublished_at": null,
"exc_customer_tags": null,
"exclude_from": 0,
"exc_customers": null,
"qb_table_type": 0,
"createdAt": "2023-03-13T09:39:48.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z",
"qbRuleQtyTables": [
{
"id": 33024,
"rule_id": 9909,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33025,
"rule_id": 9909,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 11,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"abRuleQtyTables": []
}
]

Get Rule by ID

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-by-id Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 46
}
Response body:
{
"success": true,
"rule": {
"id": 46,
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 0,
"exc_customers": [],
"exc_customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"rule_setting": 0,
"rule_type": 2,
"qty_table": [
{
"id": 33022,
"rule_id": 9792,
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
},
{
"id": 33023,
"rule_id": 9792,
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2023-05-26T04:26:21.000Z",
"updatedAt": "2023-05-26T04:26:21.000Z"
}
],
"amount_table": [],
"qb_table_type": 3,
"createdAt": "2023-03-09T02:27:26.000Z",
"updatedAt": "2023-05-30T04:29:18.000Z"
}
}

Create or Update Single Rule

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/save Method: POST Content-type: application/json Request body:
If there is no ID in request data, a new rule will be created. Otherwise, existing rule with ID will be updated.
{
"domain":"abc.myshopify.com",
"accessKey": "xxx",
"rule": {
"id": 11,
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 0,
"exc_customers": [],
"exc_customer_tags": [],
"product_condition_type": 0,
"product_ids": [],
"product_collections": [],
"product_tags": [],
"rule_setting": 0,
"rule_type": 2,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10
}
],
"amount_table": [],
"qb_table_type": 1
}
}
Response body
{
"success": true,
"ruleId": 11,
"message": "Updated the rule successfully"
}

Create or Update Multiple Rules

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/bulk-save Method: POST Content-type: application/json Request body:
If there is no ID in request data, a new rule will be created. Otherwise, existing rule with ID will be updated. If ID was incorrect or not found in one/multiple rules within the body, the rules will not be created/updated successfully.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"rules": [
{
"name": "sencond1",
"priority": 0,
"status": 1,
"apply_to": 0,
"product_condition_type": 0,
"customer_ids": [],
"customer_tags": [],
"product_ids": [],
"product_collections": [],
"product_tags": [],
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"rule_type": 2,
"rule_setting": 0,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 10
}
],
"amount_table": [],
"qb_table_type": 4
},
{
"id": 9909,
"name": "sencond2",
"priority": 0,
"status": 1,
"apply_to": 0,
"product_condition_type": 0,
"customer_ids": [],
"customer_tags": [],
"product_ids": [],
"product_collections": [],
"product_tags": [],
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"rule_type": 2,
"rule_setting": 0,
"qty_table": [
{
"qty_from": 1,
"qty_to": 4,
"discount_type": 0,
"discount_value": 10
},
{
"qty_from": 6,
"qty_to": 8,
"discount_type": 1,
"discount_value": 11
}
],
"amount_table": [],
"qb_table_type": 4
}
]
}
Response Body:
{
"success": true,
"message": [
"Rule second1 has been created successfully",
"Rule second2 has been updated successfully"
]
}

Delete Rule

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/delete Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 71
}
Response body:
{
"success": true,
"message": "Deleted rule successfully"
}

Delete Mulitple Rule

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/mass-delete Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [67,68,69]
}
Response body:
{
"success": true,
"message": "Deleted multiple qb rule successfully"
}

Get Applied Rules for Products

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-products-applied-rules Method: POST Content-type: application/json Request body:
If customer_id is null, the system will check Quantity Break Rules which applied for all customers or not-logged-in customers.
{
"domain": "abc.myshopify.com",
"accessKey": "xxxx",
"product_ids": [ 6103930831040,6103930929344],
"customer_id": 5110452355264
}
Response body:
{
"success": true,
"productsAppliedRule": [
{
"id": "6103930831040",
"rule_name": "first",
"rule_id": 51,
"qty_table": [
{
"id": 47,
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
},
{
"id": 48,
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
}
]
},
{
"id": "6103930929344",
"rule_name": "first",
"rule_id": 51,
"qty_table": [
{
"id": 47,
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
},
{
"id": 48,
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"createdAt": "2021-09-16T08:41:14.000Z",
"updatedAt": "2021-09-16T08:41:14.000Z"
}
]
}
]
}

Get Price List of Variants based on Applied Rules

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/qb/get-variants-price-list Method: POST Content-type: application/json Request body:
If customer_id is null, the system will check Quantity Break Rules which applied for all customers or not-logged-in customers.
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"product_ids": [
6103930831040,
6103930929344
],
"customer_id": 5110452355264
}
Response body:
{
"success": true,
"priceList": [
{
"id": "6103930831040",
"rule_name": "first",
"rule_id": 52,
"variants": [
{
"id": "37682508955840",
"price": "36.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
}
]
},
{
"id": "6103930929344",
"rule_name": "first",
"rule_id": 52,
"variants": [
{
"id": "37682509086912",
"price": "100.00",
"compareAtPrice": "80.00",
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509119680",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509152448",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
},
{
"id": "37682509185216",
"price": "100.00",
"compareAtPrice": null,
"appliedRulePrice": [
{
"qty_from": 6,
"qty_to": 7,
"discount_type": 1,
"discount_value": 10,
"modifiedPrice": 90
},
{
"qty_from": 1,
"qty_to": 3,
"discount_type": 0,
"discount_value": 10,
"modifiedPrice": 10
}
]
}
]
}
]
}

Product endpoints

Search products

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/product/search Method: POST Content-type: application/json Request body:
Index is a cursor value, where you want to start searching. If afterIndex is null, the system will search products from the beginning. For example:
afterIndex: "eyJsYXN0X2lkIjo2NjU1NDU2Mzc5MDUzLCJsYXN0X3ZhbHVlIjo2NjU1NDU2Mzc5MDUzfQ=="
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "ocean"
}
Response body:
{
"success":true,
"productList":{
"edges":[
{
"node":{
"id":"gid://shopify/Product/6586580271277",
"title":"Ocean Blue Shirt",
"handle":"ocean-blue-shirt",
"productType":"",
"totalVariants":1,
"hasOnlyDefaultVariant":true,
"priceRange":{
"minVariantPrice":{
"currencyCode":"VND",
"amount":"50.0"
},
"maxVariantPrice":{
"currencyCode":"VND",
"amount":"50.0"
}
},
"featuredImage":{
"transformedSrc":"https://cdn.shopify.com/s/files/1/0538/3874/1677/products/young-man-in-bright-fashion_925x_5251bcfa-6939-4d7a-9287-dd9bf058ed03.jpg?v=1616405807"
},
"onlineStoreUrl":null
},
"cursor":"eyJsYXN0X2lkIjo2NTg2NTgwMjcxMjc3LCJsYXN0X3ZhbHVlIjo2NTg2NTgwMjcxMjc3fQ=="
},
{
"node":{
"id":"gid://shopify/Product/6655456379053",
"title":"Riri Bracelet",
"handle":"riri-bracelet-rose",
"productType":"women's bracelets",
"totalVariants":1,
"hasOnlyDefaultVariant":false,
"priceRange":{
"minVariantPrice":{
"currencyCode":"VND",
"amount":"68.0"
},
"maxVariantPrice":{
"currencyCode":"VND",
"amount":"68.0"
}
},
"featuredImage":{
"transformedSrc":"https://cdn.shopify.com/s/files/1/0538/3874/1677/products/2015-04-20_Accessories_31_23500_21376.jpg?v=1619597977"
},
"onlineStoreUrl":null
},
"cursor":"eyJsYXN0X2lkIjo2NjU1NDU2Mzc5MDUzLCJsYXN0X3ZhbHVlIjo2NjU1NDU2Mzc5MDUzfQ=="
}
],
"pageInfo":{
"hasNextPage":false,
"hasPreviousPage":false
}
}
}

Get Product Tags

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-tags Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body:
{
"success":true,
"productTags":{
"tags":[
"cotton blouse",
"Couch",
"cowl",
"cpace",
"Crane",
"cream",
"crepe wool",
"crew",
"crew neck",
"crewneck",
"crisp"
],
"last_cursor":"Y3Jpc3A="
}
}

Get Products by Tags

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-tags Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"tags": ["tag1","tags2","tags3"],
"operation": "AND"
}
"Operation" is "AND" or "OR". If you use "AND", returned products must contain all tags. If you use "OR", returned products just need to belong one tag in array (["tag1","tags2","tags3"]).
Response body:
{
"success":true,
"productList":[
{
"id":"gid://shopify/Product/6586590625965",
"title":"Anchor Bracelet Mens",
"handle":"leather-anchor",
"productType":"Bracelet",
"totalVariants":2,
"hasOnlyDefaultVariant":false,
"priceRange":{
"minVariantPrice":{
"currencyCode":"VND",
"amount":"55.0"
},
"maxVariantPrice":{
"currencyCode":"VND",
"amount":"70.0"
}
},
"featuredImage":{
"transformedSrc":"https://cdn.shopify.com/s/files/1/0538/3874/1677/products/anchor-bracelet-mens_925x_8dcf313c-5c78-41ea-874d-59804d449315.jpg?v=1616407017"
},
"onlineStoreUrl":null
}
]
}

Get Products by IDs

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-ids Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [ 6586590625965 ]
}
Response body:
{
"success":true,
"productList":[
{
"id":"gid://shopify/Product/6586590625965",
"title":"Anchor Bracelet Mens",
"handle":"leather-anchor",
"productType":"Bracelet",
"totalVariants":2,
"hasOnlyDefaultVariant":false,
"priceRange":{
"minVariantPrice":{
"currencyCode":"VND",
"amount":"55.0"
},
"maxVariantPrice":{
"currencyCode":"VND",
"amount":"70.0"
}
},
"featuredImage":{
"transformedSrc":"https://cdn.shopify.com/s/files/1/0538/3874/1677/products/anchor-bracelet-mens_925x_8dcf313c-5c78-41ea-874d-59804d449315.jpg?v=1616407017"
},
"onlineStoreUrl":null
}
]
}

Customer endpoints

Get Customer Tags

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-tags Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body
{
"success":true,
"customerTags":[
{
"node":"wholesale",
"cursor":"d2hvbGVzYWxl"
}
]
}

Get Customers by IDs

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-by-ids Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [5127974846637]
}
Response body
{
"success":true,
"customerList":[
{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"[email protected]",
"firstName":"n",
"lastName":"ta"
}
]
}

Search Customers

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "nta"
}
Response body
{
"success":true,
"customers":[
{
"node":{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"[email protected]",
"firstName":"n",
"lastName":"ta",
"phone":null,
"tags":[
"wholesale"
],
"note":""
},
"cursor":"eyJsYXN0X2lkIjo1MTI3OTc0ODQ2NjM3LCJsYXN0X3ZhbHVlIjo1MTI3OTc0ODQ2NjM3fQ=="
}
]
}

Get Customers by Tags

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-by-tags Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"tags": ["tag1","tags2","tags3"],
"operation": "AND"
}
"Operation" is "AND" or "OR". If you use "AND", returned products must contain all tags. If you use "OR", returned products just need to belong one tag in array (["tag1","tags2","tags3"]).
Response body
{
"success":true,
"customers":[
{
"node":{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"[email protected]",
"firstName":"n",
"lastName":"ta",
"phone":null,
"tags":[
"wholesale"
],
"note":""
},
"cursor":"eyJsYXN0X2lkIjo1MTI3OTc0ODQ2NjM3LCJsYXN0X3ZhbHVlIjo1MTI3OTc0ODQ2NjM3fQ=="
}
]
}

Collection endpoints

Get Collections

Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/collection/get-list Method: POST Content-type: application/json Request body:
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body
{
"success":true,
"collections":[
{
"id":"gid://shopify/Collection/244026966189",
"image":null,
"title":"Home page",
"handle":"frontpage"
}
]
}
NOTE :
  • We handle one request at a time. Once your request is completed, we will proceed with the next one.
  • In case of a server error, it may take up to 3 minutes to recover and process a new request.
Last modified 6mo ago