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

# Modifier le nom

> Modifiez le nom (sujet) d'un groupe WhatsApp.

## Endpoint

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

## Headers

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

## Body Parameters

| Paramètre | Type   | Requis | Description                                                 |
| :-------- | :----- | :----- | :---------------------------------------------------------- |
| accountId | string | Oui    | L'identifiant du compte WhatsApp                            |
| groupJid  | string | Oui    | L'identifiant du groupe (format: `120363123456789012@g.us`) |
| subject   | string | Oui    | Le nouveau nom du groupe (max 100 caractères)               |

## Exemple de requête

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

## Exemple de réponse

```json theme={null}
{
  "success": true,
  "message": "Nom du groupe modifié avec succès",
  "groupJid": "120363123456789012@g.us",
  "newSubject": "Nouveau nom du groupe"
}
```

## Notes

* Vous devez être administrateur du groupe pour modifier son nom
* Le nom du groupe ne peut pas dépasser 100 caractères

## Codes d'erreur

| Code | Description                                            |
| :--- | :----------------------------------------------------- |
| 400  | `MISSING_ACCOUNT_ID` - accountId manquant              |
| 400  | `MISSING_GROUP_JID` - groupJid manquant                |
| 400  | `SUBJECT_TOO_LONG` - Le nom dépasse 100 caractères     |
| 401  | `INVALID_SECRET_KEY` - Clé secrète invalide            |
| 403  | `NOT_ADMIN` - Vous n'êtes pas administrateur du groupe |
| 404  | `ACCOUNT_NOT_FOUND` - Compte WhatsApp non trouvé       |


## OpenAPI

````yaml POST /whatsapp/groups/update/subject
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/update/subject:
    post:
      tags:
        - Groupes WhatsApp
      summary: Modifier le nom du groupe
      description: Changez le sujet (nom) du groupe.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                accountId:
                  type: string
                groupJid:
                  type: string
                subject:
                  type: string
                  description: Nouveau nom du groupe (max 100 char)
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                  newSubject:
                    type: string
      x-codeSamples:
        - lang: curl
          label: BASH
          source: >
            curl -X POST
            "https://api.wachap.com/v1/whatsapp/groups/update/subject" \
              -H "Content-Type: application/json" \
              -H "Authorization: Bearer token" \
              -d '{
                "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                "groupJid": "120363123456789012@g.us",
                "subject": "New Group Name"
              }'
        - lang: javascript
          label: JavaScript
          source: >
            const res = await
            fetch("https://api.wachap.com/v1/whatsapp/groups/update/subject", {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
                'Authorization': 'Bearer token'
              },
              body: JSON.stringify({
                accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                groupJid: "120363123456789012@g.us",
                subject: "New Group Name"
              })
            });

            const data = await res.json();

            console.log(data);
        - lang: python
          label: Python
          source: |
            import requests
            url = "https://api.wachap.com/v1/whatsapp/groups/update/subject"
            headers = {
                "Content-Type": "application/json",
                "Authorization": "Bearer token"
            }
            data = {
                "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
                "groupJid": "120363123456789012@g.us",
                "subject": "New Group Name"
            }
            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/update/subject';
            $data = [
                'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
                'groupJid' => '120363123456789012@g.us',
                'subject' => 'New Group Name'
            ];
            $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;
            ?>
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````