Skip to content

GetCollections#

Test Postman Apidog

The method is designed to retrieve the list of catalog collections with support for pagination over collections and limiting the number of products within each collection.

Behavior change

Previously the method worked without instance authorization via WhatsApp's public GraphQL. Now the instance must be authorized.
If the method is called on an unauthorized instance, an authorization error is returned.

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 get the list of collections, you need to send a request to the address:

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

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

Request parameters#

Parameter Type Required Description
chatId string Yes Seller's chat identifier in the format 79876543210@c.us
collectionLimit integer No Maximum number of collections in the response (default 10)
afterCollectionId string No Cursor for pagination. Use the paging.after value from the previous response
productLimit integer No Maximum number of products inside each collection (default 3)

Request body example#

{
  "chatId": "79876543210@c.us",
  "collectionLimit": 10,
  "afterCollectionId": "value from paging.after",
  "productLimit": 3
}

Response#

Response fields#

Field Type Description
paging object Pagination object, contains the after field – cursor for the next page
collections array Array of collection objects

Collection object (collections):

Field Type Description
id string Unique collection identifier
name string Collection name
status_info object Status information (usually null)
products array Array of products within the collection (limited by productLimit)

Product object inside the collection:

Field Type Description
id string Product identifier
name string Product name
price string Price (in the smallest currency unit)
currency string Currency code
media object Media files (images, videos)

Response body example#

{
  "paging": {
    "after": ""
  },
  "collections": [
    {
      "id": "25790827003925602",
      "name": "Kitchen Essentials",
      "status_info": null,
      "products": [
        {
          "id": "26437451389197252",
          "name": "Handmade Ceramic Mug",
          "price": "100",
          "currency": "USD",
          "media": {
            "images": [
              {
                "id": "26756491040611445",
                "original_image_url": "https://mmg.whatsapp.net/...",
                "request_image_url": "https://mmg.whatsapp.net/..."
              }
            ],
            "videos": []
          }
        }
      ]
    }
  ]
}

GetCollections errors#

For a list of common errors for all methods, see the section Common errors

Code examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/getCollections/{{apiTokenInstance}}"

payload = {
    "chatId": "79876543210@c.us",
    "collectionLimit": 10,
    "afterCollectionId": "",
    "productLimit": 3
}
headers = {
    'Content-Type': 'application/json'
}

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

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getCollections/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "79876543210@c.us",
    "collectionLimit": 10,
    "afterCollectionId": "",
    "productLimit": 3
}'