> ## Documentation Index
> Fetch the complete documentation index at: https://developer.z-api.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Search groups

> Returns all groups from the instance

## Overview

This method is responsible for returning all groups.

***

## Attributes

### Header

<ParamField path="instanceId" type="string" required>
  Your instance ID. Available in the Z-API panel under **Instances**.
</ParamField>

<ParamField path="token" type="string" required>
  Your Z-API instance token.
</ParamField>

### Query Parameters

<ParamField query="page" type="integer" required>
  Used for pagination, specify the group page you want to fetch
</ParamField>

<ParamField query="pageSize" type="integer" required>
  Specifies the number of groups returned per page
</ParamField>

***

## Response

### 200

<ResponseField name="isGroup" type="boolean">
  Whether it is a group or not
</ResponseField>

<ResponseField name="name" type="string">
  Chat name
</ResponseField>

<ResponseField name="phone" type="string">
  Group ID/Phone
</ResponseField>

<ResponseField name="unread" type="string">
  Number of unread messages in the chat
</ResponseField>

<ResponseField name="lastMessageTime" type="string">
  Timestamp with the date and time of the last interaction with the chat
</ResponseField>

<ResponseField name="isMuted" type="string">
  0 or 1 indicating if you muted this chat or not
</ResponseField>

<ResponseField name="archived" type="boolean">
  Whether the chat is archived
</ResponseField>

<ResponseField name="pinned" type="boolean">
  Whether the chat is pinned
</ResponseField>

```json theme={"theme":{"light":"github-light","dark":"poimandres"}}
[
  {
    "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".
