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

# Publier un statut

> Publiez un statut (story) WhatsApp avec du texte, une image ou une vidéo.

## Statut Texte Simple

Envoyez un message texte simple dans votre statut.

### Exemple de requête

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/status/post \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "text",
      "content": "Bonne journée à tous ! 😊"
    }'
  ```

  ```javascript JAVASCRIPT theme={null}
  const res = await fetch("https://api.wachap.com/v1/whatsapp/status/post", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer token'
    },
    body: JSON.stringify({
      accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      type: "text",
      content: "Bonne journée à tous ! 😊"
    })
  });
  const data = await res.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests
  url = "https://api.wachap.com/v1/whatsapp/status/post"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
  }
  data = {
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "text",
      "content": "Bonne journée à tous ! 😊"
  }
  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $url = 'https://api.wachap.com/v1/whatsapp/status/post';
  $data = [
      'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
      'type' => 'text',
      'content' => 'Bonne journée à tous ! 😊'
  ];
  $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;
  ?>
  ```
</CodeGroup>

***

## Statut Texte avec Style

Personnalisez la couleur de fond et la police.

### Exemple de requête

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/status/post \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "text",
      "content": "Nouveau produit disponible !",
      "backgroundColor": "#25D366",
      "font": 4,
      "privacyType": "contacts"
    }'
  ```

  ```javascript JAVASCRIPT theme={null}
  const res = await fetch("https://api.wachap.com/v1/whatsapp/status/post", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer token'
    },
    body: JSON.stringify({
      accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      type: "text",
      content: "Nouveau produit disponible !",
      backgroundColor: "#25D366",
      font: 4,
      privacyType: "contacts"
    })
  });
  const data = await res.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests
  url = "https://api.wachap.com/v1/whatsapp/status/post"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
  }
  data = {
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "text",
      "content": "Nouveau produit disponible !",
      "backgroundColor": "#25D366",
      "font": 4,
      "privacyType": "contacts"
  }
  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $url = 'https://api.wachap.com/v1/whatsapp/status/post';
  $data = [
      'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
      'type' => 'text',
      'content' => 'Nouveau produit disponible !',
      'backgroundColor' => '#25D366',
      'font' => 4,
      'privacyType' => 'contacts'
  ];
  $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;
  ?>
  ```
</CodeGroup>

***

## Statut Image avec Légende

Publiez une image avec une légende optionnelle.

### Exemple de requête

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/status/post \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "image",
      "imageUrl": "https://example.com/promo.jpg",
      "caption": "Découvrez notre nouvelle collection ! 🎉"
    }'
  ```

  ```javascript JAVASCRIPT theme={null}
  const res = await fetch("https://api.wachap.com/v1/whatsapp/status/post", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer token'
    },
    body: JSON.stringify({
      accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      type: "image",
      imageUrl: "https://example.com/promo.jpg",
      caption: "Découvrez notre nouvelle collection ! 🎉"
    })
  });
  const data = await res.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests
  url = "https://api.wachap.com/v1/whatsapp/status/post"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
  }
  data = {
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "image",
      "imageUrl": "https://example.com/promo.jpg",
      "caption": "Découvrez notre nouvelle collection ! 🎉"
  }
  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $url = 'https://api.wachap.com/v1/whatsapp/status/post';
  $data = [
      'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
      'type' => 'image',
      'imageUrl' => 'https://example.com/promo.jpg',
      'caption' => 'Découvrez notre nouvelle collection ! 🎉'
  ];
  $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;
  ?>
  ```
</CodeGroup>

***

## Statut Vidéo

Publiez une vidéo avec une légende optionnelle.

### Exemple de requête

<CodeGroup>
  ```bash BASH theme={null}
  curl -X POST https://api.wachap.com/v1/whatsapp/status/post \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer token" \
    -d '{
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "video",
      "videoUrl": "https://example.com/video.mp4",
      "caption": "Regardez notre démo produit"
    }'
  ```

  ```javascript JAVASCRIPT theme={null}
  const res = await fetch("https://api.wachap.com/v1/whatsapp/status/post", {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': 'Bearer token'
    },
    body: JSON.stringify({
      accountId: "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      type: "video",
      videoUrl: "https://example.com/video.mp4",
      caption: "Regardez notre démo produit"
    })
  });
  const data = await res.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests
  url = "https://api.wachap.com/v1/whatsapp/status/post"
  headers = {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
  }
  data = {
      "accountId": "a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878",
      "type": "video",
      "videoUrl": "https://example.com/video.mp4",
      "caption": "Regardez notre démo produit"
  }
  response = requests.post(url, json=data, headers=headers)
  print(response.json())
  ```

  ```php PHP theme={null}
  <?php
  $url = 'https://api.wachap.com/v1/whatsapp/status/post';
  $data = [
      'accountId' => 'a1233b-a1233b-a1233b-a1233b-a1233bcdjdg9878',
      'type' => 'video',
      'videoUrl' => 'https://example.com/video.mp4',
      'caption' => 'Regardez notre démo produit'
  ];
  $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;
  ?>
  ```
</CodeGroup>


## OpenAPI

````yaml POST /whatsapp/status/post
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/status/post:
    post:
      tags:
        - Statuts
      summary: Publier un statut
      description: >-
        Publiez un statut (story) WhatsApp avec du texte, une image ou une
        vidéo.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                accountId:
                  type: string
                type:
                  type: string
                  enum:
                    - text
                    - image
                    - video
                content:
                  type: string
                imageUrl:
                  type: string
                videoUrl:
                  type: string
                backgroundColor:
                  type: string
                font:
                  type: integer
                privacyType:
                  type: string
      responses:
        '200':
          description: OK
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````