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

# Réimporter une liste depuis CSV

> Remplacez tous les contacts d’une liste par un nouveau CSV

### Endpoint

<ParamField method="POST" path="/v1/contact-groups/:id/reimport" />

### Headers

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

### URL Parameters

<ParamField path="id" type="string" required>
  L'identifiant de la liste
</ParamField>

### Body Parameters

<ParamField body="csvUrl" type="string" required>
  URL du nouveau fichier CSV à importer
</ParamField>

### Format du fichier CSV

Le fichier CSV doit contenir au minimum une colonne `phone`.

```csv theme={null}
phone,name,city,email
+2290112345678,John Doe,Abidjan,john@example.com
+33612345678,Marie Dupont,Paris,marie@example.com
```

### Exemples de requêtes

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/reimport \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "csvUrl": "https://example.com/new-contacts.csv"
    }'
  ```

  ```javascript JAVASCRIPT theme={null}
  const response = await fetch('https://api.wachap.com/v1/contact-groups/65f1234567890abcdef12345/reimport', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer token',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      csvUrl: "https://example.com/new-contacts.csv"
    })
  });
  const data = await response.json();
  console.log(data);
  ```
</CodeGroup>

### Exemple de réponse

```json theme={null}
{
  "success": true,
  "message": "Réimport déclenché",
  "status": "importing"
}
```

### Avertissement

<Warning>
  **Cette action est irréversible !**

  * Tous les contacts existants seront supprimés.
  * Le nouveau CSV sera importé à leur place.
</Warning>

### Codes d'erreur

| Code  | Description                                               |
| :---- | :-------------------------------------------------------- |
| `400` | MISSING\_CSV\_URL - csvUrl est requis                     |
| `401` | INVALID\_SECRET\_KEY - Clé secrète invalide               |
| `404` | Liste non trouvée                                         |
| `500` | REIMPORT\_CONTACT\_GROUP\_ERROR - Erreur lors du réimport |


## OpenAPI

````yaml POST /contact-groups/{id}/reimport
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/{id}/reimport:
    post:
      tags:
        - Listes de contacts
      summary: Réimporter une liste
      description: Remplacez tous les contacts d'une liste par un nouveau CSV.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                csvUrl:
                  type: string
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````