# 🔗Public APIs for Price List (PL)

These **REST APIs** let you manage **customer pricing rules**, calculate **variant prices** based on rules, and fetch **customers/products**.

> **Requirements**
>
> * Install the **BSS B2B Solution** Shopify app
> * Get your **Access Key** (see below)

***

### 🔑 Get the Access Key

1. Open the **BSS B2B Solution** app.
2. Go to **Public API**.
3. Click **Copy** to copy your **accessKey**.
4. Include it in the request body for every call.

***

### 🧱 Rule Endpoints

#### Rule Field Reference

**priority**\
Determines whether a rule is prioritized over another.

**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
```

**apply\_at**

```
0: Product level
1: Variant level
```

**exc\_product\_type**

```
0: None
4: Exclude specific variants
```

**exclude\_from**

```
0: none
1: customer tags
2: specific customers
```

**discount\_type**

```
0: Apply a decreasing 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 (%)
3: Apply an increasing price to selected products
4: Increase a fixed amount of the original prices of selected products
5: Increase the original prices of selected products by a percentage (%)
```

\</details>

***

#### Get rules by domain

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-by-domain`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "rules": [
    {
      "id": 186827,
      "shop_id": 16109,
      "name": "Pricelist_1",
      "priority": 0,
      "status": 1,
      "apply_to": 0,
      "apply_at": 0,
      "customer_ids": "",
      "customer_tags": "",
      "exc_customer_tags": "",
      "exclude_from": 0,
      "start_date": "2024-06-25T08:23:09.000Z",
      "end_date": "2024-06-25T08:23:09.000Z",
      "exc_customers": "",
      "start_time": "15:23:00",
      "end_time": "15:23:00",
      "enable_end_date": 0,
      "file_theme_index": null,
      "exc_product_collections": "",
      "exc_product_tags": "",
      "exc_product_type": 4,
      "exc_product_variants": "40201792192587,40201792225355",
      "exc_specific_products": "",
      "createdAt": "2024-06-25T08:23:11.000Z",
      "updatedAt": "2024-06-25T08:23:11.000Z",
      "deletedAt": null
    },
    {
      "id": 186828,
      "shop_id": 16109,
      "name": "Pricelist_2",
      "priority": 0,
      "status": 1,
      "apply_to": 4,
      "apply_at": 1,
      "customer_ids": "",
      "customer_tags": "b2b",
      "exc_customer_tags": "",
      "exclude_from": 0,
      "start_date": "2024-06-25T08:53:01.000Z",
      "end_date": "2024-06-25T08:53:01.000Z",
      "exc_customers": "",
      "start_time": "15:53:00",
      "end_time": "15:53:00",
      "enable_end_date": 0,
      "file_theme_index": null,
      "exc_product_collections": "",
      "exc_product_tags": "",
      "exc_product_type": 0,
      "exc_product_variants": "",
      "exc_specific_products": "",
      "createdAt": "2024-06-25T08:53:02.000Z",
      "updatedAt": "2024-06-25T08:53:02.000Z",
      "deletedAt": null
    }
  ]
}
```

{% endcode %}

***

#### Get rules by id

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-by-id`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "id": 7
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "rule": {
    "id": 186827,
    "name": "Pricelist_1",
    "priority": 0,
    "status": 1,
    "apply_to": 0,
    "apply_at": 0,
    "exclude_from": 0,
    "exc_product_type": 4,
    "start_date": "2024-06-25T08:23:09.000Z",
    "end_date": "2024-06-25T08:23:09.000Z",
    "customer_ids": [],
    "customer_tags": [],
    "exc_customer_tags": [],
    "exc_customers": [],
    "exc_product_collections": [],
    "exc_product_tags": [],
    "exc_product_variants": [
      "40201792192587",
      "40201792225355"
    ],
    "exc_specific_products": [],
    "start_time": "15:23:00",
    "end_time": "15:23:00",
    "enable_end_date": 0,
    "selected_products": [
      { "product_id": "6909579886667", "discount_type": 0, "discount_value": 111 },
      { "product_id": "6909579558987", "discount_type": 0, "discount_value": 300 },
      { "product_id": "6909579919435", "discount_type": 0, "discount_value": 505 },
      { "product_id": "6909579853899", "discount_type": 0, "discount_value": 333 },
      { "product_id": "6909579690059", "discount_type": 0, "discount_value": 333 }
    ],
    "selected_variants": []
  }
}
```

{% endcode %}

***

#### Get rules by products

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-rules-by-products`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "product_ids": [7208233467979, 7208233467980],
  "product_tags": ["b2b", "pants"]
}
```

> You can choose to get rules by either **product IDs** or **product tags**.

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "data": [
    { "productId": "7208233467979", "variantId": "41007944728651", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 600 },
    { "productId": "7208233467979", "variantId": "41007944761419", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 400 },
    { "productId": "7208233467979", "variantId": "41007944794187", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 600 },
    { "productId": "7208233467979", "variantId": "41007944826955", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 600 },
    { "productId": "7208207614027", "variantId": "41007876440139", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 95 },
    { "productId": "7208207614027", "variantId": "41007876472907", "ruleId": 124, "ruleName": "Rule name", "appliedPrice": 95 }
  ]
}
```

{% endcode %}

***

#### Get rules by customers

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-rules-by-customers`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "customer_ids": [7208233467979, 7208233467980],
  "customer_tags": ["b2b", "pants"]
}
```

> You can choose to get rules by either **customer IDs** or **customer tags**.

**Response (example)**

{% code expandable="true" %}

```json
{
  "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"]
        }
      ]
    }
  ]
}
```

{% endcode %}

***

#### Create or Update a single rule

> **Limit:** You can create a rule of **10,000 products/variants**.

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/save`

**Headers**

```
Content-Type: application/json
```

**Body**\
If there is **no `id`** in the request data, a **new** rule is created. Otherwise, **all the data** of the existing rule with `id` will be **replaced**.

{% code expandable="true" %}

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "data": {
    "name": "pricelist_3",
    "priority": 3,
    "status": 1,
    "apply_to": 1,
    "apply_at": 1,
    "selected_products": [],
    "selected_variants": [
      { "product_id": "8174450049309", "variant_id": "44524354928925", "discount_type": 1, "discount_value": 123 },
      { "product_id": "8174450049309", "variant_id": "44524354961693", "discount_type": 2, "discount_value": 10 }
    ],
    "customer_ids": [],
    "customer_tags": [],
    "exclude_from": 1,
    "exc_customer_tags": ["b2b"],
    "exc_customers": "",
    "exc_product_type": 4,
    "exc_product_variants": [
      39699783614639,
      39699785384111,
      42752015040687,
      39699790430383,
      39699784728751,
      42752028967087,
      40205671989423
    ],
    "start_date": null,
    "end_date": null
  }
}
```

{% endcode %}

**Response (example)**

```json
{
  "success": true,
  "message": "Created the pricing list rule successfully",
  "payload": { "id": 186829 }
}
```

***

#### Create or Update multiple rules

> **Limit:** You can create a rule of **10,000 products/variants**.

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/bulk-save`

**Headers**

```
Content-Type: application/json
```

**Body**\
If there is **no `id`**, a new rule is created. Otherwise, the existing rule with `id` will be **overridden**.

{% code expandable="true" %}

```json
{
  "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": [],
      "exc_product_type": 4,
      "exc_product_variants": [
        39699783614639,
        39699785384111,
        42752015040687,
        39699790430383,
        39699784728751,
        42752028967087,
        40205671989423
      ],
      "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": 1,
      "selected_products": [],
      "selected_variants": [
        { "product_id": "8174450049309", "variant_id": "44524354928925", "discount_type": 1, "discount_value": 123 },
        { "product_id": "8174450049309", "variant_id": "44524354961693", "discount_type": 2, "discount_value": 10 }
      ],
      "customer_ids": [],
      "customer_tags": [],
      "exc_customer_tags": ["Leorio"],
      "exclude_from": 1,
      "exc_customers": [],
      "exc_product_type": 0,
      "exc_product_variants": [],
      "start_date": "2022-03-08T17:00:00.000Z",
      "end_date": "2022-03-25T17:00:00.000Z"
    }
  ]
}
```

{% endcode %}

**Response (example)**

```json
{
  "success": true,
  "message": [
    "Create new rule 'Rule name' with ID 186830 successfully",
    "Update rule ID 124 successfully"
  ]
}
```

***

#### Update product data to a single rule

This endpoint helps you:

* **Add new specific products** to your existing rule\
  (If the product/variant ID does **not** exist in the rule, it is treated as **new**)
* **Edit existing product data** in the rule\
  (If the product/variant ID **already exists**, it is treated as **existing**)

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/update`

**Headers**

```
Content-Type: application/json
```

**Body**

{% code expandable="true" %}

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "data": {
    "id": 204987,
    "name": "PL rule",
    "priority": 87,
    "status": 0,
    "apply_to": 3,
    "apply_at": 1,
    "selected_products": [],
    "selected_variants": [
      { "product_id": 7607393812655, "variant_id": 42752015040687, "discount_type": 1, "discount_value": 59 },
      { "product_id": 6669597180079, "variant_id": 39700823736495, "discount_type": 2, "discount_value": 78 },
      { "product_id": 6669280215215, "variant_id": 39699785384111, "discount_type": 2, "discount_value": 74 }
    ],
    "customer_ids": [5898365796527, 5904531751087, 5895219937455, 6827377393839],
    "customer_tags": [],
    "exclude_from": 1,
    "exc_customer_tags": ["ccc", "exc_cus"],
    "exc_customers": [],
    "exc_product_type": 4,
    "exc_product_variants": [
      39699783614639,
      42752028967087,
      40205671989423,
      39699790430383,
      40205671956655,
      42752015040687,
      39699784728751
    ],
    "start_date": "2024-10-17T02:42:59.660Z",
    "end_date": "2024-10-17T02:44:39.660Z"
  }
}
```

{% endcode %}

**Response**

```json
{
  "success": true,
  "message": "Rule ID 204987 is updated"
}
```

***

#### Update product data to multiple rules

This endpoint helps you:

* **Add new specific products** to your existing rules
* **Edit existing product data** in the rules

**PUT** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/update-items`

**Headers**

```
Content-Type: application/json
```

**Body**

{% code expandable="true" %}

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xyz",
  "rules": [
    {
      "id": 124,
      "apply_at": 1,
      "selected_products": [],
      "selected_variants": [
        { "product_id": 7208207614027, "variant_id": 41007876440139, "discount_type": 1, "discount_value": 30 },
        { "product_id": 7208207614027, "variant_id": 41007876472907, "discount_type": 2, "discount_value": 10 }
      ]
    },
    {
      "id": 204987,
      "apply_at": 0,
      "selected_products": [
        { "product_id": 7607393812655, "discount_type": 1, "discount_value": 59 },
        { "product_id": 6669597180079, "discount_type": 2, "discount_value": 78 },
        { "product_id": 6669280215215, "discount_type": 2, "discount_value": 74 }
      ],
      "selected_variants": []
    }
  ]
}
```

{% endcode %}

**Response (success)**

```json
{
  "success": true,
  "message": "Success",
  "data": {
    "success": ["Rule ID 204987 updated", "Rule ID 204990 updated"],
    "failed": []
  }
}
```

**Response (mixed)**

```json
{
  "success": true,
  "message": "Success",
  "data": {
    "success": ["Rule ID 124 updated"],
    "failed": [
      { "rule_id": 204987, "errors": ["ID does not exist"] }
    ]
  }
}
```

***

#### Delete rule

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/delete`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "id": 6
}
```

**Response**

```json
{
  "success": true,
  "message": "Deleted rule successfully"
}
```

***

#### Delete multiple rules

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/bulk-delete`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "ids": [6, 7]
}
```

**Response**

```json
{
  "success": true,
  "message": "Deleted multiple rule successfully"
}
```

***

#### Remove existing products from rules

**PUT** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/delete-items`

**Headers**

```
Content-Type: application/json
```

**Body**

{% code expandable="true" %}

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "rules": [
    {
      "id": 1,
      "apply_at": 0,
      "product_ids": ["8746948362490", "8746948329722"],
      "variant_ids": []
    },
    {
      "id": 2,
      "apply_at": 1,
      "product_ids": [],
      "variant_ids": ["8746948362455", "8746948329777"]
    }
  ]
}
```

{% endcode %}

**Response (success)**

```json
{
  "success": true,
  "message": "Success",
  "data": {
    "success": ["Rule ID 1 updated"],
    "failed": []
  }
}
```

**Response (error)**

```json
{
  "success": false,
  "message": "Fail",
  "data": {
    "success": [],
    "failed": [
      {
        "rule_id": 2,
        "errors": ["Invalid apply_at", "variant_ids must be array"]
      }
    ]
  }
}
```

***

#### Get Applied Rules for Products

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-products-applied-rules`

**Headers**

```
Content-Type: application/json
```

**Body**\
If `customer_id` is **null**, the system checks Price List Rules that apply to **all** or **not-logged-in** customers.

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxxx",
  "product_ids": [6701683802197, 6701684228181],
  "customer_id": 5639955775573
}
```

**Response (example)**

```json
{
  "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

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/pl/get-variants-price-list`

**Headers**

```
Content-Type: application/json
```

**Body**\
If `customer_id` is **null**, the system checks Price List Rules that apply to **all** or **not-logged-in** customers.\
`"expand"` must be `"products"` or `"variants"` based on the **applied level** in the rule.

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxxx",
  "product_ids": [6701683802197, 6701684228181],
  "customer_id": 5639955775573,
  "expand": "products"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "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 }
      ]
    }
  ]
}
```

{% endcode %}

***

### 🛍️ Product Endpoints

#### Search products

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/product/search`

**Headers**

```
Content-Type: application/json
```

**Body**\
`afterIndex` is a cursor. If `null`, search starts from the beginning.\
Example cursor: `eyJsYXN0X2lkIjo2NjU1NDU2Mzc5MDUzLCJsYXN0X3ZhbHVlIjo2NjU1NDU2Mzc5MDUzfQ==`

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "afterIndex": null,
  "first": 20,
  "searchQuery": "ocean"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "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 }
  }
}
```

{% endcode %}

***

#### Get Product Tags

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-tags`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{ "domain": "abc.myshopify.com", "accessKey": "xxx" }
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "success": true,
  "productTags": {
    "tags": [
      "cotton blouse",
      "Couch",
      "cowl",
      "cpace",
      "Crane",
      "cream",
      "crepe wool",
      "crew",
      "crew neck",
      "crewneck",
      "crisp"
    ],
    "last_cursor": "Y3Jpc3A="
  }
}
```

{% endcode %}

***

#### Get Products by Tags

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-tags`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "afterIndex": null,
  "first": 20,
  "tags": ["tag1", "tags2", "t3"],
  "operation": "AND"
}
```

> **Operation**\
> `"AND"` → returned products must contain **all** tags.\
> `"OR"` → returned products must contain **any** tag in the array.

**Response (example)**

{% code expandable="true" %}

```json
{
  "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
    }
  ]
}
```

{% endcode %}

***

#### Get Products by IDs

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/product/get-by-ids`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "ids": [6586590625965]
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "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
    }
  ]
}
```

{% endcode %}

***

### 👤 Customer Endpoints

#### Search Customers

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "afterIndex": null,
  "first": 20,
  "searchQuery": "nta"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "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=="
    }
  ]
}
```

{% endcode %}

***

#### Get Customer Tags

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/get-tags`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{ "domain": "abc.myshopify.com", "accessKey": "xxx" }
```

**Response (example)**

```json
{
  "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**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "ids": [5127974846637]
}
```

**Response (example)**

```json
{
  "success": true,
  "customerList": [
    {
      "id": "gid://shopify/Customer/5127974846637",
      "displayName": "nta",
      "email": "abc@gmail.com",
      "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**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "afterIndex": null,
  "first": 20,
  "tags": ["tag1", "tags2"],
  "operation": "AND"
}
```

> **Operation**\
> `"AND"` → must contain **all** tags.\
> `"OR"` → must contain **any** tag.

**Response (example)**

{% code expandable="true" %}

```json
{
  "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=="
    }
  ]
}
```

{% endcode %}

***

### 🗂️ Collection Endpoints

> As provided, **Get Collections** uses the `/customer/search` endpoint and returns a `customers` array.

**POST** `https://b2b-solution-public-api.bsscommerce.com/api/v1/customer/search`

**Headers**

```
Content-Type: application/json
```

**Body**

```json
{
  "domain": "abc.myshopify.com",
  "accessKey": "xxx",
  "afterIndex": null,
  "first": 20,
  "searchQuery": "nta"
}
```

**Response (example)**

{% code expandable="true" %}

```json
{
  "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=="
    }
  ]
}
```

{% endcode %}

***

### ⚙️ Request Handling Policy

* We handle **one request at a time**.
* After your request is completed, the next one will be processed.
* In case of a **server error**, it may take **up to 3 minutes** to recover and process a new request.
