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

# Créer un groupe

> Créez un nouveau groupe WhatsApp avec des participants

## Créer un groupe

Créez un nouveau groupe WhatsApp et ajoutez-y immédiatement des participants.

### Endpoint

<ParamField method="POST" path="/v1/whatsapp/groups" />

### Headers

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

### Body Parameters

<ParamField body="accountId" type="string" required>
  L'identifiant du compte WhatsApp
</ParamField>

<ParamField body="groupName" type="string" required>
  Le nom du groupe à créer
</ParamField>

<ParamField body="participants" type="array" required>
  Liste des numéros de téléphone des participants (format international)
</ParamField>

### Exemples de requêtes

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/groups \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "groupName": "Mon Nouveau Groupe",
      "participants": ["+33612345678", "+2290112345678"]
    }'
  ```
</CodeGroup>

### Exemple de réponse

```json theme={null}
{
  "success": true,
  "message": "Groupe créé avec succès",
  "group": {
    "jid": "120363123456789012@g.us",
    "name": "Mon Nouveau Groupe",
    "owner": "2290112345678@s.whatsapp.net",
    "creation": 1702000000,
    "participants": [
      "33612345678@s.whatsapp.net",
      "2290112345678@s.whatsapp.net"
    ]
  }
}
```

### Notes importantes

* Les participants doivent être des numéros au format international.
* Vous serez automatiquement ajouté comme administrateur du groupe.
* Minimum 1 participant requis (en plus de vous).

### Codes d'erreur

| Code  | Description                                                       |
| :---- | :---------------------------------------------------------------- |
| `400` | MISSING\_ACCOUNT\_ID, MISSING\_GROUP\_NAME, MISSING\_PARTICIPANTS |
| `401` | INVALID\_SECRET\_KEY - Clé secrète invalide                       |
| `404` | ACCOUNT\_NOT\_FOUND - Compte WhatsApp non trouvé                  |


## OpenAPI

````yaml POST /whatsapp/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:
  /whatsapp/groups:
    post:
      tags:
        - Groupes
      summary: Créer un groupe
      description: Créez un nouveau groupe WhatsApp avec des participants.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                accountId:
                  type: string
                groupName:
                  type: string
                participants:
                  type: array
                  items:
                    type: string
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````