Skip to main content

Create Product Group

Creates a new product group. Use product groups to control which shoppers can see a set of products.

HTTP Request​

  • URL: /productGroup/create
  • Method: POST
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_PRODUCTGROUP

Request Body​

Send the details of the new product group.

FieldTypeRequiredDescription
nameStringYesName of the product group.
statusBooleanNoWhether the product group is active. Default is false.
restrictAccessBooleanNoHide the group's products from shoppers who are not given access. Default is false.
hiddenFromArrayNoShopper types to hide the group's products from: guest, b2c. Default is [].
productsArrayNoIDs of the products to add to the group.

cURL Example​

curl --location '<BASE_URL>/productGroup/create' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Contractor Exclusives",
"status": true,
"restrictAccess": true,
"hiddenFrom": ["guest", "b2c"],
"products": ["64f123abc456789012345679", "64f123abc45678901234567a"]
}'

Response​

  • 200 OK: The product group was created successfully.
  • 400 Bad Request: The access token is missing or invalid, or the request body is empty or not valid.

Sample JSON Response​

{
"success": true,
"message": "ProductGroup created Successfully",
"data": {
"_id": "6711a0c4e306999fab205805",
"name": "Contractor Exclusives",
"status": true,
"restrictAccess": true,
"hiddenFrom": ["guest", "b2c"],
"createdAt": "2024-10-18T00:01:40.071Z",
"updatedAt": "2024-10-18T00:01:40.071Z"
}
}

Response Details​

Product Group Data​

FieldTypeDescription
_idStringUnique identifier of the product group.
nameStringName of the product group.
statusBooleanWhether the product group is active.
restrictAccessBooleanWhether the group's products are hidden from shoppers who are not given access.
hiddenFromArrayShopper types the group's products are hidden from.
createdAtStringDate and time the group was created (ISO 8601).
updatedAtStringDate and time the group was last updated (ISO 8601).

Notes​

  • guest means shoppers who are not signed in. b2c means signed-in customers who don't belong to a company.
  • restrictAccess and hiddenFrom apply only while the group is active (status is true).
  • To give specific companies, company groups or customers access to a restricted group, use Assign Product Group Rules.