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

> Récupérez toutes vos listes de contacts. Les listes sont triées par date de création décroissante.

### Endpoint

<ParamField method="GET" path="/v1/contact-groups" />

### Headers

<ParamField header="Authorization" type="string" required>
  Bearer token avec votre Secret Key (format: `Bearer sk_...`)
</ParamField>

### Exemples de requêtes

<CodeGroup>
  ```bash BASH theme={null}
  curl -X GET https://api.wachap.com/v1/contact-groups \
    -H "Authorization: Bearer token"
  ```

  ```javascript JAVASCRIPT theme={null}
  const response = await fetch('https://api.wachap.com/v1/contact-groups', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer token'
    }
  });
  const data = await response.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests
  url = "https://api.wachap.com/v1/contact-groups"
  headers = { "Authorization": "Bearer token" }
  response = requests.get(url, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $curl = curl_init();
  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.wachap.com/v1/contact-groups",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer token"],
  ]);
  $response = curl_exec($curl);
  curl_close($curl);
  echo $response;
  ?>
  ```
</CodeGroup>

### Exemple de réponse

```json theme={null}
{
  "success": true,
  "total": 3,
  "lists": [
    {
      "$id": "65f1234567890abcdef12345",
      "userId": "user_xxx",
      "name": "Clients Premium",
      "csvUrl": null,
      "status": "ready",
      "createdAt": "2024-03-15T10:00:00.000Z",
      "updatedAt": "2024-03-15T10:00:00.000Z",
      "totalContacts": 150
    },
    {
      "$id": "65f1234567890abcdef12347",
      "userId": "user_xxx",
      "name": "Import en cours",
      "csvUrl": "https://example.com/importing.csv",
      "status": "importing",
      "createdAt": "2024-03-16T11:00:00.000Z",
      "updatedAt": "2024-03-16T11:00:00.000Z",
      "totalContacts": 0
    }
  ]
}
```

### Champs de la réponse

| Champ           | Type   | Description                      |
| :-------------- | :----- | :------------------------------- |
| `$id`           | string | Identifiant unique de la liste   |
| `name`          | string | Nom de la liste                  |
| `status`        | string | Statut (ready, importing)        |
| `totalContacts` | number | Nombre de contacts dans la liste |
| `createdAt`     | string | Date de création                 |

### Codes d'erreur

| Code  | Description                                                   |
| :---- | :------------------------------------------------------------ |
| `401` | INVALID\_SECRET\_KEY - Clé secrète invalide                   |
| `500` | LIST\_CONTACT\_GROUPS\_ERROR - Erreur lors de la récupération |


## OpenAPI

````yaml GET /contact-groups
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:
  /contact-groups:
    get:
      tags:
        - Listes de contacts
      summary: Lister les listes de contacts
      description: Récupérer toutes vos listes de contacts.
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````