Skip to main content
GET
/
instances
/
{instanceId}
/
token
/
{token}
/
groups
Search groups
curl --request GET \
  --url https://api.z-api.io/instances/{instanceId}/token/{token}/groups \
  --header 'Client-Token: <api-key>'
{
  "isGroup": true,
  "name": "<string>",
  "phone": "<string>",
  "unread": "<string>",
  "lastMessageTime": "<string>",
  "isMuted": "<string>",
  "archived": true,
  "pinned": true
}

Overview

This method is responsible for returning all groups.

Attributes

instanceId
string
required
Your instance ID. Available in the Z-API panel under Instances.
token
string
required
Your Z-API instance token.

Query Parameters

page
integer
required
Used for pagination, specify the group page you want to fetch
pageSize
integer
required
Specifies the number of groups returned per page

Response

200

isGroup
boolean
Whether it is a group or not
name
string
Chat name
phone
string
Group ID/Phone
unread
string
Number of unread messages in the chat
lastMessageTime
string
Timestamp with the date and time of the last interaction with the chat
isMuted
string
0 or 1 indicating if you muted this chat or not
archived
boolean
Whether the chat is archived
pinned
boolean
Whether the chat is pinned
[
  {
    "isGroup": true,
    "name": "Test group",
    "phone": "120263358412332916-group",
    "unread": "0",
    "lastMessageTime": "1730918668000",
    "isMuted": "0",
    "isMarkedSpam": "false",
    "archived": "false",
    "pinned": "false",
    "muteEndTime": null,
    "messagesUnread": "0"
  }
]

405

Make sure you are correctly sending the method specification, that is, verify that you sent POST or GET as specified at the beginning of this topic.

415

If you receive a 415 error, make sure to add the “Content-Type” header to your request, which in most cases is “application/json”.