Public APIs for Custom Pricing (CP)
B2B & Wholesale Custom Pricing Public API for Shopify Stores
Custom pricing public API is an feature of B2B/Wholesale Solution shopify app. To use APIs, you must install app, upgrade to Platinum plan and get the access key.
These APIs are REST APIs. You can use them to manage customer pricing rules, calculate variants' price based on rules, search customers, get products, etc. Detailed instructions on how to do it is showing bellow:
How to get the access key
After you install the B2B/Wholesale Solution Shopify app. Go to the Public API page, and 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
4: Specific variants
- exc_product_type:
0: None
1: Specific products
2: Product collections
3: Product tags
4: Specific variants
- 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 (%)
- market_condition_type:
0: All markets
1: Specific markets
Get rules by domain
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-by-domain
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response
{
"success": true,
"rules": [
{
"id": 536662,
"shop_id": 9204,
"name": "Discount 20%l",
"priority": 1,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"product_condition_type": 4,
"product_ids": [],
"variant_ids": [
"6586590625965",
"6586590658733",
"6586590691501"
],
"product_collections": [],
"product_tags": [],
"discount_type": 2,
"discount_value": "10.00",
"published_at": null,
"unpublished_at": null,
"date_rule_type": 0,
"start_date": null,
"end_date": null,
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"market_condition_type": 1,
"market_ids": [
"49314136349"
],
"file_theme_index": 0,
"createdAt": "2023-03-09T03:38:50.000Z",
"updatedAt": "2023-06-15T02:16:47.000Z"
},
{
"id": 545507,
"shop_id": 9204,
"name": "test4",
"priority": 0,
"status": 0,
"apply_to": 3,
"customer_ids": [
"6819529654557",
"6905095291165"
],
"customer_tags": [],
"product_condition_type": 0,
"product_ids": [
"8174450049309"
],
"product_collections": [],
"product_tags": [],
"discount_type": 0,
"discount_value": "50.00",
"published_at": null,
"unpublished_at": null,
"date_rule_type": 0,
"start_date": null,
"end_date": null,
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"market_condition_type": 0,
"market_ids": [],
"file_theme_index": 0,
"createdAt": "2023-03-15T07:33:24.000Z",
"updatedAt": "2023-06-05T01:59:50.000Z"
}
]
}
Get rule by ID
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-by-id
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 79
}
Response
{
"success": true,
"rule": {
"id": 79,
"name": "Discount 20%l",
"priority": 1,
"status": 1,
"apply_to": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 0,
"exc_customers": [],
"exc_customer_tags": [],
"product_condition_type": 4,
"product_ids": [],
"variant_ids": [
"6586590625965",
"6586590658733",
"6586590691501"
],
"product_collections": [],
"product_tags": [],
"market_condition_type": 1,
"market_ids": [
"49314136349"
],
"discount_type": 2,
"discount_value": "10.00",
"start_date": null,
"end_date": null
}
}
Get rules by products
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-rules-by-products
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"product_ids": [7208233467979, 7208233467980],
"product_tags": ["b2b", "pants"]
}
Response
{
"success": true,
"data": [
{
"productId": "8249126813999",
"ruleId": 40,
"ruleName": "VIP group",
"appliedPrice": 27100
},
{
"productId": "8249222791471",
"ruleId": 40,
"ruleName": "VIP group",
"appliedPrice": 63.5
}
]
}
Get rules by customers
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-rules-by-customers
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"customer_ids": [7208233467979, 7208233467980],
"customer_tags": ["b2b", "pants"]
}
Response
{
"success": true,
"data": [
{
"customerId": "6764123291723",
"rules": [
{
"ruleId": 2151079182,
"ruleName": "Wholesale",
"customerTags": [
"b2b"
]
}
]
},
{
"customerId": "7196156198987",
"rules": [
{
"ruleId": 2151079182,
"ruleName": "Wholesale",
"customerTags": [
"b2b"
]
}
]
},
{
"customerId": "7905261387851",
"rules": [
{
"ruleId": 2151079182,
"ruleName": "Wholesale",
"customerTags": [
"b2b"
]
}
]
}
]
}
Create or Update a single rule
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/save
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"rule": {
"name": "Test rule",
"priority": 1,
"status": 0,
"apply_to": 1,
"product_condition_type":4,
"customer_ids": [],
"customer_tags": [],
"product_ids": [
"5460196589730"
],
"variant_ids": [],
"product_collections": [],
"product_tags": [],
"discount_type": 2,
"discount_value": "40",
"exclude_from":0,
"exc_customers": ["5462063382693"],
"exc_customer_tags": [],
"exc_product_type": 4,
"exc_specific_products": [],
"exc_product_tags": [],
"exc_product_collections": [],
"exc_product_variants": [
44531061752093,
45056544342301
],
"market_condition_type": 0,
"market_ids": []
}
}
Response
{
"success": true,
"message": "Create the rule successfully",
"ruleId": 11
}
Create or Update multiple rules
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/bulk-save
Headers
Content-Type
application/json
Body
{
"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": [],
"variant_ids": [],
"product_collections": [],
"product_tags": [],
"exc_customer_tags": "",
"exclude_from": 0,
"exc_customers": "",
"exc_product_type": 0,
"exc_specific_products": [],
"exc_product_tags": [],
"exc_product_collections": [],
"exc_product_variants": [],
"discount_type": 2,
"discount_value": 10.00,
"date_rule_type": 0,
"start_date": null,
"end_date": null,
"market_condition_type": 0,
"market_ids": null
},
{
"id": 545507,
"name": "test4",
"priority": 0,
"status": 0,
"apply_to": 3,
"customer_ids": [
"6819529654557",
"6905095291165"
],
"customer_tags": [],
"product_condition_type": 0,
"product_ids": [
"8174450049309"
],
"variant_ids": [],
"product_collections": [],
"product_tags": [],
"discount_type": 0,
"discount_value": "50.00",
"date_rule_type": 0,
"start_date": null,
"end_date": null,
"exc_customer_tags": "",
"exclude_from": 0,
"exc_product_type": 3,
"exc_specific_products": [],
"exc_product_tags": [
"b2b",
"wholesale"
],
"exc_product_collections": [],
"exc_product_variants": [],
"exc_customers": "",
"market_condition_type": 0,
"market_ids": []
}
]
}
Response
{
"success": true,
"message": [
"Create new rule 'sencond1' with ID 214780831 successfully",
"Update rule 'test4' with ID 545507 successfully"
]
}
Delete rule
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/delete
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 79
}
Response
{
"success": true,
"message": "Deleted rule ID 79 successfully"
}
Delete multiple rules
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/mass-delete
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [79,80,81]
}
Response
{
"success": true,
"message": "Deleted multiple rule successfully"
}
Remove existing products from rules
PUT
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/delete-items
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"rules": [
{
"id": 2,
"product_condition_type": 1,
"product_ids": [
"8746948329722",
"8746948821242",
"7622399262970",
"7622389432570"
],
"product_collections": [],
"product_tags": [],
"product_variants": []
},
{
"id": 3,
"product_condition_type": 1,
"product_ids": [
"8746948329722",
"8746948821242",
"7622399262970",
"7622389432570"
],
"product_collections": [],
"product_tags": [],
"product_variants": []
}
]
}
Response
{
"success": true,
"message": "Success",
"data": {
"success": [
"Update rule with id 2 success"
],
"failed":[]
}
}
Get Applied Rules for Products
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-products-applied-rules
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"product_ids": [ 6586590625965, 6586590658733, 6586590691501 ],
"customer_id": 5127974846637,
"accessKey": "xxxx"
}
Response
{
"success":true,
"productsAppliedRule":[
{
"id":"6586590625965",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%"
},
{
"id":"6586590658733",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%"
},
{
"id":"6586590691501",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%"
}
]
}
Get Price List of Variants based on Applied Rules
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-variants-price-list
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"product_ids": [ 6586590625965, 6586590658733, 6586590691501 ],
"customer_id": 5127974846637,
"accessKey": "xxx"
}
Response
{
"success":true,
"priceList":[
{
"id":"6586590625965",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%",
"variants":[
{
"id":"39454422368429",
"price":"70",
"compareAtPrice":"85",
"appliedRulePrice":63
},
{
"id":"39454422401197",
"price":"55",
"compareAtPrice":"85",
"appliedRulePrice":49.5
}
]
},
{
"id":"6586590658733",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%",
"variants":[
{
"id":"39454422433965",
"price":"40",
"compareAtPrice":"44",
"appliedRulePrice":36
}
]
},
{
"id":"6586590691501",
"discount_type":2,
"value":"10.00",
"name":"Discount 30%",
"variants":[
{
"id":"39454422466733",
"price":"43",
"compareAtPrice":"45",
"appliedRulePrice":38.7
}
]
}
]
}
Product endpoints
Search products
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/product/search
Headers
Content-Type
application/json
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
{
"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
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-tags
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response
{
"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
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-tags
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"tags": ["tag1","tags2","t3"],
"operation": "AND"
}
Response
{
"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
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-ids
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [ 6586590625965 ]
}
Response
{
"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
Search Customers
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "nta"
}
Response
{
"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 Customer Tags
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-tags
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response
{
"success":true,
"customerTags":[
{
"node":"wholesale",
"cursor":"d2hvbGVzYWxl"
}
]
}
Get Customers by IDs
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-by-ids
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [5127974846637]
}
Response
{
"success":true,
"customerList":[
{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"[email protected]",
"firstName":"n",
"lastName":"ta"
}
]
}
Get Customers by Tags
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-by-tags
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"tags": ["tag1", "tags2"],
"operation": "AND"
}
Response
{
"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
POST
https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search
Headers
Content-Type
application/json
Body
{
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "nta"
}
Response
{
"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=="
}
]
}
Last updated
Was this helpful?