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.
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | Name of the product group. |
status | Boolean | No | Whether the product group is active. Default is false. |
restrictAccess | Boolean | No | Hide the group's products from shoppers who are not given access. Default is false. |
hiddenFrom | Array | No | Shopper types to hide the group's products from: guest, b2c. Default is []. |
products | Array | No | IDs 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
| Field | Type | Description |
|---|---|---|
_id | String | Unique identifier of the product group. |
name | String | Name of the product group. |
status | Boolean | Whether the product group is active. |
restrictAccess | Boolean | Whether the group's products are hidden from shoppers who are not given access. |
hiddenFrom | Array | Shopper types the group's products are hidden from. |
createdAt | String | Date and time the group was created (ISO 8601). |
updatedAt | String | Date and time the group was last updated (ISO 8601). |
Notes
guestmeans shoppers who are not signed in.b2cmeans signed-in customers who don't belong to a company.restrictAccessandhiddenFromapply only while the group is active (statusistrue).- To give specific companies, company groups or customers access to a restricted group, use Assign Product Group Rules.