> ## 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 contatos

> Lista paginada dos contatos do número

## Conceituação

Lista paginada dos contatos do número.

> [!NOTE]
>
> A paginação é por cursor opaco: devolva o `nextCursor` exatamente como veio para a próxima página. `pageSize` é 20 por padrão, sem máximo. O `nextCursor` vem `null` só quando a página tem menos itens que `pageSize`; se a última página tiver exatamente `pageSize` itens, a próxima vem vazia.


## OpenAPI

````yaml pt/contacts/openapi.json GET /v1/channels/{channelId}/contacts
openapi: 3.1.0
info:
  title: Omni Z-API - Contatos
  version: 1.0.0
servers:
  - url: https://api.omni.z-api.io
security:
  - bearerAuth: []
paths:
  /v1/channels/{channelId}/contacts:
    get:
      tags:
        - Contatos
      summary: Listar contatos
      description: >-
        Lista os contatos da agenda do número, paginada por cursor. Só no canal
        WhatsApp Web (`Z_API_WHATSAPP`).
      operationId: listContacts
      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
            minimum: 1
            example: 20
        - name: cursor
          in: query
          required: false
          description: >-
            Cursor opaco da próxima página. Devolva exatamente o `nextCursor`
            recebido; omita para começar do início.
          schema:
            type: string
      responses:
        '200':
          description: Lista de contatos
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContactList'
              example:
                content:
                  - id: '554497294996'
                    phone: '554497294996'
                    name: Contato de teste
                    shortName: Contato
                    profileName: Contato de teste
                    vcardName: Contato de teste
                  - id: 123330724110591@lid
                    phone: null
                    name: Contato por LID
                    shortName: Contato
                    profileName: Contato por LID
                    vcardName: Contato por LID
                nextCursor: 8xkQ2
        '400':
          description: Parâmetro fora do formato
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                cursor:
                  summary: cursor inválido
                  value:
                    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
                pageSize:
                  summary: pageSize inválido
                  value:
                    error: invalid_request
                    field: pageSize
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/InstanceNotFound'
        '422':
          description: >-
            Instância não provisionada, assinatura inativa, workspace bloqueado
            ou operação não suportada no canal, verificados nesta ordem (o `404`
            de canal inexistente vem antes de todos). Só o 422 de operação não
            suportada traz `message`, e ele é para leitura: trate pelo `error`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                instanceNotProvisioned:
                  summary: Instância não provisionada
                  value:
                    error: instance is not provisioned
                subscriptionInactive:
                  summary: Assinatura inativa
                  value:
                    error: instance subscription is not active
                blockedWorkspace:
                  summary: Workspace bloqueado
                  value:
                    error: You are blocked, contact support.
                operationNotSupportedMeta:
                  summary: Canal WhatsApp Oficial (Meta)
                  value:
                    error: operation not supported for this instance
                    message: >-
                      Listing contacts is not supported on WhatsApp official API
                      (Meta) channels: the official API does not give access to
                      the contacts of the number. Use a WhatsApp Web channel for
                      contacts; GET /v1/channels/{id}/contacts/capabilities
                      lists what each channel supports.
                operationNotSupportedOtherChannel:
                  summary: >-
                    Canal Telegram (Instagram e Messenger: mesmo texto, com o
                    nome do canal)
                  value:
                    error: operation not supported for this instance
                    message: >-
                      Listing contacts is not supported on Telegram channels:
                      contacts belong to a WhatsApp number, and this channel has
                      none. Use a WhatsApp Web channel for contacts; GET
                      /v1/channels/{id}/contacts/capabilities lists what each
                      channel supports.
                operationNotSupportedNoType:
                  summary: Canal ainda sem tipo
                  value:
                    error: operation not supported for this instance
                    message: >-
                      Listing contacts is not supported on this instance: it is
                      not connected to any channel type yet. Use a WhatsApp Web
                      channel for contacts; GET
                      /v1/channels/{id}/contacts/capabilities lists what each
                      channel supports.
        '502':
          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.
components:
  schemas:
    ContactList:
      type: object
      properties:
        content:
          type: array
          items:
            $ref: '#/components/schemas/ContactListItem'
        nextCursor:
          type: string
          nullable: true
          description: >-
            Cursor da próxima página. Vem `null` só quando a página tem menos
            itens que `pageSize`; se a última página tiver exatamente `pageSize`
            itens, a próxima vem vazia.
    Error:
      type: object
      properties:
        error:
          type: string
        field:
          type: string
        message:
          type: string
    ContactListItem:
      type: object
      properties:
        id:
          type: string
        phone:
          type: string
          nullable: true
        name:
          type: string
        shortName:
          type: string
        profileName:
          type: string
        vcardName:
          type: string
  responses:
    Unauthorized:
      description: >-
        Secret Key recusada. Vem com o header `WWW-Authenticate: Bearer`; o
        `message` muda com o motivo (ver [Autenticação](/authentication)).
      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 do workspace (ver [Restrição de
        IP](/security/ip-restriction))
      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: Instância (canal) não encontrada
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: instance not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret Key

````

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