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

Overview

This method is responsible for returning all chats.

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 chat page you want to fetch
pageSize
integer
required
Specifies the number of chats returned per page

Response

200

archived
boolean
Whether the chat is archived
pinned
boolean
Whether the chat is pinned
phone
string
Contact phone number
unread
string
Number of unread messages
name
string
Chat name (returns IDs for groups/broadcast lists)
lastMessageTime
string
Last interaction timestamp
isMuted
string
0 or 1 indicating if chat is muted
isMarkedSpam
boolean
Whether the chat is marked as spam
isGroup
boolean
Whether it is a group
notes
object
Chat annotations (available only for WhatsApp Business)
[
  {
    "archived": "false",
    "pinned": "true",
    "messagesUnread": 0,
    "phone": "5511999999999",
    "unread": "0",
    "name": "Z-API SUPPORT",
    "lastMessageTime": "1622991687",
    "isMuted": "0",
    "isMarkedSpam": "false",
    "isGroupAnnouncement": false,
    "isGroup": false
  },
  {
    "archived": "false",
    "pinned": "true",
    "messagesUnread": 0,
    "phone": "5511999999999",
    "unread": "0",
    "name": "Z-api - Team",
    "lastMessageTime": "1622990503",
    "muteEndTime": 1655953774000,
    "isMuted": "0",
    "isMarkedSpam": "false",
    "isGroupAnnouncement": false,
    "isGroup": false,
    "notes": {
      "id": "KlesU6f4f/Qd5d6VuAbvOMi31rg/F92owVe/xDYad1C=",
      "content": "annotation text",
      "createdAt": 1655953774000,
      "lastUpdateAt": 1655953774000
    }
  }
]

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”.