> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wappfy.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# List All Groups

> List all groups of the WhatsApp session

## Description

This endpoint returns a list of all groups that the session is participating in.

## URL Parameters

<ParamField path="session" type="string" required>
  WhatsApp unique session ID
</ParamField>

## Response

<ResponseField name="groups" type="array">
  Array containing all groups of the session
</ResponseField>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "groups": [
      {
        "id": "120363XXXXX@g.us",
        "subject": "Group 1",
        "participants": [...],
        "creation": 1234567890
      },
      {
        "id": "120363YYYYY@g.us",
        "subject": "Group 2",
        "participants": [...],
        "creation": 1234567891
      }
    ]
  }
  ```
</ResponseExample>

## Status Codes

* `200` - Groups listed successfully
* `400` - Invalid parameters
* `401` - Unauthorized

## Usage Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET https://api.wappfy.com.br/api/my-session/groups
  ```

  ```javascript JavaScript theme={null}
  const session = 'my-session';
  const response = await fetch(`https://api.wappfy.com.br/api/${session}/groups`);
  const data = await response.json();
  console.log(data.groups);
  ```

  ```python Python theme={null}
  import requests

  session = 'my-session'
  response = requests.get(f'https://api.wappfy.com.br/api/{session}/groups')
  data = response.json()
  print(data['groups'])
  ```
</CodeGroup>


## OpenAPI

````yaml viewer-en.json get /api/{session}/groups
openapi: 3.1.0
info:
  title: Wappfy - WhatsApp HTTP API
  version: '2.0'
  contact: {}
servers:
  - url: https://{host}
    description: Customizable Server
    variables:
      host:
        default: api.wappfy.com.br
        description: Server URL (e.g., api.wappfy.com.br or your-server.com)
security:
  - api_key: []
tags:
  - name: 🖥️ Sessions
    description: Control WhatsApp sessions (accounts)
  - name: 🔑 Auth
    description: Authentication
  - name: 🆔 Profile
    description: Your profile information
  - name: 🖼️ Screenshot
    description: Get WhatsApp screenshot and display QR code
  - name: 📤 Chatting
    description: Conversation methods
  - name: 📢 Channels
    description: Channels (newsletters) methods
  - name: 🟢 Status
    description: Status (aka stories) methods
  - name: 💬 Chats
    description: Conversations methods
  - name: 👤 Contacts
    description: |-
      Contacts methods.<br>
                      Use phone number (without +) or phone number and `@c.us` at the end as `contactId`.<br>
                      E.g: `12312312310` OR `12312312310@c.us`<br>
  - name: 👥 Groups
    description: Groups methods.<br>
  - name: ✅ Presence
    description: Presence information
  - name: 📅 Events
    description: Event Message
  - name: 🏷️ Labels
    description: Labels - available only for WhatsApp Business accounts
  - name: 🔍 Observability
    description: Other methods
  - name: 🗄️ Storage
    description: Storage methods
externalDocs:
  description: Wappfy - WhatsApp API
  url: https://docs.wappfy.com.br/
paths:
  /api/{session}/groups:
    get:
      tags:
        - 👥 Groups
      summary: Get all groups
      description: The {session} parameter must be the session's instanceName.
      operationId: GroupsController_getGroups
      parameters:
        - name: sortBy
          required: false
          in: query
          description: Sort by field
          schema:
            enum:
              - id
              - subject
            type: string
        - name: sortOrder
          required: false
          in: query
          description: >-
            Sort order - <b>desc</b>ending (Z => A, New first) or
            <b>asc</b>ending (A => Z, Old first)
          schema:
            enum:
              - desc
              - asc
            type: string
        - name: limit
          required: false
          in: query
          schema:
            type: number
        - name: offset
          required: false
          in: query
          schema:
            type: number
        - name: exclude
          required: false
          in: query
          description: Exclude fields
          schema:
            type: array
            items:
              type: string
              enum:
                - ''
                - participants
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
      security:
        - api_key: []
components:
  securitySchemes:
    api_key:
      type: apiKey
      in: header
      name: apikey
      description: Your Wappfy API key (get it at dash.wappfy.com.br)

````