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

# Listar grupos

> Lista paginada dos grupos do número

## Conceituação

Lista paginada dos grupos do número.

> [!NOTE]
>
> A paginação é por cursor opaco: devolva o `nextCursor` como veio para a próxima página. O `pageSize` é 20 por padrão, sem máximo (inteiro positivo de até 9 dígitos). O `nextCursor` só vem nulo quando a página tem menos itens que o `pageSize` — uma última página com exatamente `pageSize` itens é seguida por uma página vazia. O cursor de grupos (`g1:`) não serve para contatos.


## OpenAPI

````yaml pt/groups/openapi.json GET /v1/channels/{channelId}/groups
openapi: 3.1.0
info:
  title: Omni Z-API - Grupos
  version: 1.0.0
servers:
  - url: https://api.omni.z-api.io
security:
  - bearerAuth: []
paths:
  /v1/channels/{channelId}/groups:
    get:
      tags:
        - Grupos
      summary: Listar grupos
      description: >-
        Lista os grupos do número, paginada por cursor. Só no canal WhatsApp Web
        (`Z_API_WHATSAPP`).
      operationId: listGroups
      parameters:
        - name: channelId
          in: path
          required: true
          description: Channel id
          schema:
            type: string
            example: 58907809F0964E998D36C87F10EBA60C
        - name: pageSize
          in: query
          required: false
          description: >-
            Quantidade por página. Padrão 20, sem máximo, inteiro positivo de
            até 9 dígitos.
          schema:
            type: integer
            example: 20
        - name: cursor
          in: query
          required: false
          description: >-
            Cursor opaco da próxima página. Devolva exatamente o `nextCursor`
            recebido.
          schema:
            type: string
      responses:
        '200':
          description: Listar grupos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GroupList'
              example:
                content:
                  - id: 120363430328583007-group
                    name: Teste ZAPI-8975
                nextCursor: 8xkQ2
        '400':
          description: Cursor fora do formato
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: invalid_request
                field: cursor
                message: >-
                  cursor is not valid: send back exactly the nextCursor returned
                  by the previous page, or leave it out to start from the first
                  page
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/InstanceNotFound'
        '422':
          description: >-
            Operação indisponível no canal, instância não provisionada,
            assinatura inativa ou workspace bloqueado
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                operationNotSupported:
                  summary: Canal sem suporte a grupos nesta API
                  value:
                    error: operation not supported for this instance
                instanceNotProvisioned:
                  summary: Instância não provisionada
                  value:
                    error: instance is not provisioned
                subscriptionInactive:
                  summary: Assinatura inativa
                  value:
                    error: instance subscription is not active
                workspaceBlocked:
                  summary: Workspace bloqueado
                  value:
                    error: You are blocked, contact support.
                    message: >-
                      You are blocked, contact support. This workspace is
                      blocked on the platform, so sending, editing and group
                      calls are refused until it is unblocked. Talk to support
                      through the panel at https://app.omni.z-api.io.
        '502':
          $ref: '#/components/responses/ProviderResponseTooLarge'
components:
  schemas:
    GroupList:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/GroupSummary'
        nextCursor:
          type: string
          nullable: true
          description: >-
            Cursor da próxima página. Só vem nulo quando a página tem menos
            itens que pageSize; uma última página com exatamente pageSize itens
            é seguida por uma página vazia. O cursor de grupos (g1:) não serve
            para contatos.
    Error:
      type: object
      properties:
        error:
          type: string
        field:
          type: string
        message:
          type: string
    GroupSummary:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
  responses:
    Unauthorized:
      description: Secret Key ausente ou inválida
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Authorization invalid
            message: >-
              Authorization invalid: the Authorization header is missing or
              empty. Send the workspace Secret Key as "Authorization: Bearer
              <secret-key>". See
              https://developer.omni.z-api.io/en/authentication
      headers:
        WWW-Authenticate:
          description: Sempre `Bearer`
          schema:
            type: string
          example: Bearer
    Forbidden:
      description: IP fora da lista de IPs do workspace
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: ip_not_allowed
            message: >-
              203.0.113.10 not allowed: this workspace only accepts API calls
              from the IPs on its allow list. The workspace Owner can add this
              IP under Administration > Security > IP Restriction in the panel
              (changes take up to 10 minutes to apply), or call from an allowed
              IP. See https://developer.omni.z-api.io/en/security/ip-restriction
    InstanceNotFound:
      description: Canal (instância) não encontrado
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: instance not found
    ProviderResponseTooLarge:
      description: Resposta do canal grande demais
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: provider_response_too_large
            message: The channel answer is too large. Use a smaller pageSize.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.