CreateCollection#
To use this method, you must have a WhatsApp Business account.
The method is designed to create a product collection in the catalog. Collections allow grouping products by categories (e.g., "Kitchen", "Clothing").
After creation, a collection can be edited using the EditCollection method (the id of the collection will change).
The order of collections can be changed using the MoveCollections method.
WhatsApp-side limitations
If catalog methods are called frequently, WhatsApp may temporarily restrict access to the Business Catalog API. Do not send a large number of requests to catalog methods over a short period of time.
Request#
To create a collection, you need to send a request to the address:
{{apiUrl}}/waInstance{{idInstance}}/createCollection/{{apiTokenInstance}}
To obtain the request parameters idInstance and apiTokenInstance, refer to the section Before you start.
Request parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Collection name |
productIds | array | Yes | Array of product identifiers to be added to the collection |
Request body example#
{
"name": "Kitchen Essentials",
"productIds": ["26437451389197252", "25789428137398187"]
}
Response#
Response fields#
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier of the created collection in WhatsApp |
Response body example#
{
"id": "25790827003925602"
}
CreateCollection errors#
For a list of common errors for all methods, see the section Common errors
| HTTP code | Error identifier | Description |
|---|---|---|
| 400 | Catalog mutations require a business account | WhatsApp-side restriction that occurs when catalog methods are called frequently. Returned even when the request is made from a Business account |
Code examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/createCollection/{{apiTokenInstance}}"
payload = {
"name": "Kitchen Essentials",
"productIds": ["26437451389197252", "25789428137398187"]
}
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/createCollection/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Kitchen Essentials",
"productIds": ["26437451389197252", "25789428137398187"]
}'