B2B/Wholesale Pricing List Public API for Shopify Stores
These APIs are REST APIs. You can use them to manage customer pricing rules, calculate variants' prices based on rules, search for customers, get products, etc. Detailed instructions on how to do it are shown below:
How to get the access key
After you install 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:
Copy 0: inactive
1: active
- apply_to:
Copy 0: All customers
1: Logged-in customers
2: Not-logged-in customers
3: Specific customers
4: Customer tags
-apply_at:
Copy 0: Product level
1: Variant level
- exclude_from:
Copy 0: none
1: customer tags
2: specific customers
- discount_type:
Copy 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/pl/get-by-domain
Method: POST
Content-type: application/json
Request body:
Copy domain: your default Shopify store domain.
accessKey: value of access key.
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body:
Copy {
"success": true,
"rules": [
{
"id": 4,
"shop_id": 14,
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"customer_ids": "",
"customer_tags": "",
"exc_customer_tags": "abc",
"exclude_from": 1,
"exc_specific_customers: "",
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z",
"createdAt": "2022-03-07T09:17:54.000Z",
"updatedAt": "2022-03-07T09:17:54.000Z"
},
{
"id": 5,
"shop_id": 14,
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"customer_ids": "",
"customer_tags": "",
"exclude_from": 1,
"exc_customer_tags": "abc",
"exc_customers": "",
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z",
"createdAt": "2022-03-07T09:19:29.000Z",
"updatedAt": "2022-03-07T09:19:29.000Z"
}
]
}
Get Rule by ID
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-by-id
Method: POST
Content-type: application/json
Request body:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 7
}
Response body:
Copy {
"success": true,
"rule": {
"id": 7,
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"apply_at": 0,
"customer_ids": [],
"customer_tags": [],
"exclude_from": 1,
"exc_customer_tags": [
"abc"
],
"exc_customers": [5346117025837],
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z",
"selected_products": [
{
"product_id": "6701684228181",
"discount_type": 1,
"discount_value": 123
},
{
"product_id": "6701683802197",
"discount_type": 2,
"discount_value": 10
}
]
}
}
Create or Update a Single Rule
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/save
Method: POST
Content-type: application/JSON
Request body:
If there is no ID in requested data, a new rule will be created. Otherwise, the existing rule with ID will be updated.
Copy {
"domain":"abc.myshopify.com",
"accessKey": "xxx",
"data": {
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"apply_at": 0,
"selected_products": [ {"product_id":"6701684228181", "discount_type":1, "discount_value": 123 }, {"product_id": "6701683802197", "discount_type": 2, "discount_value": 10} ],
"customer_ids": [],
"customer_tags": [],
"exclude_from": 1,
"exc_customer_tags": [ "abc" ],
"exc_customers": "",
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z"
}
}
Response body
Copy {
"success": true,
"message": "Create the pricing list rule successfully",
"payload": {
"id": 1230
}
}
Create or Update Multiple Rules
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/bulk-save
Method: POST
Content-type: application/json
Request body:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"rules": [{
"id": null,
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"apply_at": 0,
"selected_products": [ {"product_id":"6701684228181", "discount_type":1, "discount_value": 123 }, {"product_id": "6701683802197", "discount_type": 2, "discount_value": 10} ],
"customer_ids": [],
"customer_tags": [],
"exc_customer_tags": [ "Leorio" ],
"exclude_from": 1,
"exc_customers": "",
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z"
},
{
"id": 124,
"name": "Rule name",
"priority": 3,
"status": 1,
"apply_to": 1,
"apply_at": 0,
"selected_products": [ {"product_id":"6701684228181", "discount_type":1, "discount_value": 123 }, {"product_id": "6701683802197", "discount_type": 2, "discount_value": 10} ],
"customer_ids": [],
"customer_tags": [],
"exc_customer_tags": [ "Leorio" ],
"exclude_from": 1,
"exc_customers": "",
"start_date": "2022-03-08T17:00:00.000Z",
"end_date": "2022-03-25T17:00:00.000Z"
}]
}
Response Body:
Copy {
"success": true,
"message": "RETURN MESSAGE",
"payload": [
{ id: 123, action: "create", result: "success" },
{ id: 124, action: "update", result: "error" },
]
}
Delete Rule
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/delete
Method: POST
Content-type: application/json
Request body:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"id": 6
}
Response body:
Copy {
"success": true,
"message": "Deleted rule successfully"
}
Delete Mulitple Rule
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/bulk-delete
Method: POST
Content-type: application/json
Request body:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [6, 7]
}
Response body:
Copy {
"success": true,
"message": "Deleted multiple rule successfully"
}
Get Applied Rules for Products
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-products-applied-rules
Method: POST
Content-type: application/json
Request body:
If customer_id is null, the system will check Custom Pricing Rules which applied for all customers or not-logged-in customers .
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxxx",
"product_ids": [ 6701683802197, 6701684228181 ],
"customer_id": 5639955775573
}
Response body:
Copy {
"success": true,
"productsAppliedRule": [
{
"id": "6701683802197",
"discount_type": 2,
"value": "10.00",
"name": "Rule name"
},
{
"id": "6701684228181",
"discount_type": 1,
"value": "123.00",
"name": "Rule name"
}
]
}
Get Price List of Variants based on Applied Rules
Request URL: https://b2b-solution-public-api.bsscommerce.com/api/v1/rule/get-variants-price-list
Method: POST
Content-type: application/json
Request body:
If customer_id is null, the system will check Custom Pricing Rules which applied for all customers or not-logged-in customers .
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxxx",
"product_ids": [ 6701683802197, 6701684228181 ],
"customer_id": 5639955775573
}
Response body:
Copy {
"success": true,
"priceList": [
{
"id": "6701683802197",
"discount_type": 2,
"value": "10.00",
"name": "Rule name",
"variants": [
{
"id": "39878990823509",
"price": "30",
"compareAtPrice": null,
"appliedRulePrice": 27
},
{
"id": "39878990856277",
"price": "30",
"compareAtPrice": null,
"appliedRulePrice": 27
}
]
},
{
"id": "6701684228181",
"discount_type": 1,
"value": "123.00",
"name": "Rule name",
"variants": [
{
"id": "39878991315029",
"price": "619",
"compareAtPrice": null,
"appliedRulePrice": 496
}
]
}
]
}
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:
Copy afterIndex: "eyJsYXN0X2lkIjo2NjU1NDU2Mzc5MDUzLCJsYXN0X3ZhbHVlIjo2NjU1NDU2Mzc5MDUzfQ=="
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "ocean"
}
Response body:
Copy {
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body:
Copy {
"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:
Copy {
"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:
Copy {
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [ 6586590625965 ]
}
Response body:
Copy {
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body
Copy {
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"ids": [5127974846637]
}
Response body
Copy {
"success":true,
"customerList":[
{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"abc@gmail.com",
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx",
"afterIndex": null,
"first": 20,
"searchQuery": "nta"
}
Response body
Copy {
"success":true,
"customers":[
{
"node":{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"abc@gmail.com",
"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:
Copy {
"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
Copy {
"success":true,
"customers":[
{
"node":{
"id":"gid://shopify/Customer/5127974846637",
"displayName":"nta",
"email":"abc@gmail.com",
"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:
Copy {
"domain": "abc.myshopify.com",
"accessKey": "xxx"
}
Response body
Copy {
"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.