Skip to content

EditCollection#

Test Postman Apidog

To use this method, you must have a WhatsApp Business account.

The method is designed to edit an existing collection: changing the name, adding and removing products.

After editing a collection, its identifier (id) changes. Use the newCollectionId from the response for all subsequent operations with this collection.

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 edit a collection, you need to send a request to the address:

POST
{{apiUrl}}/waInstance{{idInstance}}/editCollection/{{apiTokenInstance}}

To obtain the request parameters idInstance and apiTokenInstance, refer to the section Before you start.

Request parameters#

Parameter Type Required Description
collectionId string Yes Unique identifier of the collection to be edited
name string No New collection name
productIdsToAdd array No Array of product identifiers to add to the collection
productIdsToRemove array No Array of product identifiers to remove from the collection

The name, productIdsToAdd, and productIdsToRemove fields can be passed in any combination, but at least one of them must be specified in addition to collectionId.

Request body example#

{
  "collectionId": "25790827003925602",
  "name": "Home Essentials",
  "productIdsToAdd": ["26429381740022203"],
  "productIdsToRemove": ["25789428137398187"]
}

Response#

Response fields#

Field Type Description
edited boolean Returns true if the edit was successful
newCollectionId string New identifier of the edited collection

Response body example#

{
  "edited": true,
  "newCollectionId": "2205593430194788"
}

EditCollection 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}}/editCollection/{{apiTokenInstance}}"

payload = {
    "collectionId": "25790827003925602",
    "name": "Home Essentials",
    "productIdsToAdd": ["26429381740022203"],
    "productIdsToRemove": ["25789428137398187"]
}
headers = {
    'Content-Type': 'application/json'
}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/editCollection/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "collectionId": "25790827003925602",
    "name": "Home Essentials",
    "productIdsToAdd": ["26429381740022203"],
    "productIdsToRemove": ["25789428137398187"]
}'