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

# Lister les membres

> Récupérez la liste des membres d'un groupe WhatsApp.

## Endpoints

### Option 1: GroupJid dans le body

```http theme={null}
POST https://api.wachap.com/v1/whatsapp/groups/members/list
```

### Option 2: GroupJid dans l'URL (rétrocompatibilité)

```http theme={null}
POST https://api.wachap.com/v1/whatsapp/groups/:groupJid/members/list
```

## Headers

| Paramètre     | Type   | Requis | Description                                                  |
| :------------ | :----- | :----- | :----------------------------------------------------------- |
| Authorization | string | Oui    | Bearer token avec votre Secret Key (format: `Bearer sk_...`) |

## Body Parameters (Option 1)

| Paramètre | Type   | Requis | Description                                                 |
| :-------- | :----- | :----- | :---------------------------------------------------------- |
| accountId | string | Oui    | L'identifiant du compte WhatsApp                            |
| groupJid  | string | Oui    | L'identifiant du groupe (format: `120363123456789012@g.us`) |

## Body Parameters (Option 2)

| Paramètre | Type   | Requis | Description                      |
| :-------- | :----- | :----- | :------------------------------- |
| accountId | string | Oui    | L'identifiant du compte WhatsApp |

## Exemples de requêtes

### Option 1: GroupJid dans le body

```bash theme={null}
curl -X POST https://api.wachap.com/v1/whatsapp/groups/members/list \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer token" \
  -d '{
    "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
    "groupJid": "120363123456789012@g.us"
  }'
```

### Option 2: GroupJid dans l'URL

```bash theme={null}
curl -X POST https://api.wachap.com/v1/whatsapp/groups/120363123456789012@g.us/members/list \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer token" \
  -d '{
    "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878"
  }'
```

## Exemple de réponse

```json theme={null}
{
  "success": true,
  "message": "Membres récupérés avec succès",
  "groupJid": "120363123456789012@g.us",
  "total": 15,
  "members": [
    {
      "jid": "2290112345678@s.whatsapp.net",
      "phoneNumber": "2290112345678",
      "name": "John Doe",
      "isAdmin": true,
      "isSuperAdmin": true
    },
    {
      "jid": "33612345678@s.whatsapp.net",
      "phoneNumber": "33612345678",
      "name": "Marie Dupont",
      "isAdmin": false,
      "isSuperAdmin": false
    }
  ]
}
```

## Codes d'erreur

| Code | Description                                      |
| :--- | :----------------------------------------------- |
| 400  | `MISSING_ACCOUNT_ID` - accountId manquant        |
| 400  | `MISSING_GROUP_JID` - groupJid manquant          |
| 401  | `INVALID_SECRET_KEY` - Clé secrète invalide      |
| 404  | `ACCOUNT_NOT_FOUND` - Compte WhatsApp non trouvé |
| 404  | `GROUP_NOT_FOUND` - Groupe non trouvé            |


## OpenAPI

````yaml POST /whatsapp/groups/members/list
openapi: 3.0.3
info:
  title: WaChap API
  version: 2.0.0
servers:
  - url: https://api.wachap.com/v1
    description: WaChap API server
security:
  - BearerAuth: []
tags:
  - name: Instances
    description: Créer et gérer des instances WhatsApp
  - name: Webhook
    description: Configuration des webhooks de réception
  - name: Messages
    description: Envoyer des messages WhatsApp
  - name: Comptes
    description: Gérer vos comptes WhatsApp connectés
  - name: SMS
    description: Service SMS de WaChap (V4) via FCM
  - name: Étiquettes WhatsApp
    description: Créer et associer des étiquettes aux conversations WhatsApp
paths:
  /whatsapp/groups/members/list:
    post:
      tags:
        - Groupes WhatsApp
      summary: Lister les membres
      description: Récupérez la liste des membres d'un groupe WhatsApp.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                accountId:
                  type: string
                  description: L'identifiant du compte WhatsApp
                groupJid:
                  type: string
                  description: 'L''identifiant du groupe (format: 120363123456789012@g.us)'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  groupJid:
                    type: string
                  total:
                    type: integer
                  members:
                    type: array
                    items:
                      type: object
                      properties:
                        jid:
                          type: string
                        phoneNumber:
                          type: string
                        name:
                          type: string
                        isAdmin:
                          type: boolean
                        isSuperAdmin:
                          type: boolean
      x-codeSamples:
        - lang: curl
          label: BASH
          source: >
            curl -X POST
            "https://api.wachap.com/v1/whatsapp/groups/members/list" \
              -H "Content-Type: application/json" \
              -H "Authorization: Bearer token" \
              -d '{ "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878", "groupJid": "120363123456789012@g.us" }'
        - lang: javascript
          label: JavaScript
          source: >
            const res = await
            fetch("https://api.wachap.com/v1/whatsapp/groups/members/list", {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
                'Authorization': 'Bearer token'
              },
              body: JSON.stringify({
                accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                groupJid: "120363123456789012@g.us"
              })
            });

            const data = await res.json();

            console.log(data);
        - lang: python
          label: Python
          source: |
            import requests
            url = "https://api.wachap.com/v1/whatsapp/groups/members/list"
            headers = {
                "Content-Type": "application/json",
                "Authorization": "Bearer token"
            }
            data = {
                "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                "groupJid": "120363123456789012@g.us"
            }
            response = requests.post(url, json=data, headers=headers)
            print(response.json())
        - lang: php
          label: PHP
          source: |
            <?php
            $url = 'https://api.wachap.com/v1/whatsapp/groups/members/list';
            $data = [
                'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
                'groupJid' => '120363123456789012@g.us'
            ];
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_POST, 1);
            curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, [
                'Content-Type: application/json',
                'Authorization: Bearer token'
            ]);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;
            ?>
        - lang: go
          label: Go
          source: |
            package main
            import (
              "bytes"
              "encoding/json"
              "fmt"
              "net/http"
            )
            func main() {
              url := "https://api.wachap.com/v1/whatsapp/groups/members/list"
              data := map[string]string{
                "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                "groupJid":  "120363123456789012@g.us",
              }
              jsonData, _ := json.Marshal(data)
              req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
              req.Header.Set("Content-Type", "application/json")
              req.Header.Set("Authorization", "Bearer token")
              client := &http.Client{}
              resp, _ := client.Do(req)
              defer resp.Body.Close()
              fmt.Println(resp.Status)
            }
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````