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

# Envoyer un message

> Envoi de texte ou média via requête GET.



## OpenAPI

````yaml /api/openapi.yaml get /send
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:
  /send:
    get:
      tags:
        - Messages
      summary: Envoyer un message (GET)
      description: Envoyer un message texte ou média via requête GET.
      parameters:
        - name: number
          in: query
          required: true
          schema:
            type: string
          description: Numéro WhatsApp du destinataire
        - name: type
          in: query
          required: true
          schema:
            type: string
            enum:
              - text
              - media
          description: Type de message
        - name: message
          in: query
          required: true
          schema:
            type: string
          description: Contenu du message
        - name: media_url
          in: query
          required: false
          schema:
            type: string
            format: uri
          description: URL du média à envoyer (si type=media)
        - name: filename
          in: query
          required: false
          schema:
            type: string
          description: Nom du fichier (si type=media)
        - name: instance_id
          in: query
          required: true
          schema:
            type: string
          description: Identifiant de l'instance
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message_id:
                    type: string
                  message:
                    type: string
              examples:
                text:
                  value:
                    status: 200
                    message_id: MSG-12345
                    message: Message texte envoyé
                media:
                  value:
                    status: 200
                    message_id: MSG-67890
                    message: Message média envoyé
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >
            curl
            "https://api.wachap.com/v1/send?number=2299775xxxx&type=text&message=Hello%20from%20cURL&instance_id=609ACF283XXXX&access_token=646116c7XXXX"
        - lang: javascript
          label: JavaScript
          source: >
            const params = new URLSearchParams({
              number: '2299775xxxx',
              type: 'text',
              message: 'Hello from JS',
              instance_id: '609ACF283XXXX',
              access_token: '646116c7XXXX'
            });

            const res = await
            fetch(`https://api.wachap.com/v1/send?${params.toString()}`);

            const data = await res.json();

            console.log(data);
        - lang: python
          label: Python
          source: |
            import requests
            params = {
              'number': '2299775xxxx',
              'type': 'text',
              'message': 'Hello from Python',
              'instance_id': '609ACF283XXXX',
              'access_token': '646116c7XXXX'
            }
            r = requests.get('https://api.wachap.com/v1/send', params=params)
            print(r.json())
        - lang: curl
          label: cURL (media)
          source: >
            curl
            "https://api.wachap.com/v1/send?number=2299775xxxx&type=media&message=Photo&media_url=https%3A%2F%2Fi.pravatar.cc%2F300&filename=file_test.jpg&instance_id=609ACF283XXXX&access_token=646116c7XXXX"
        - lang: php
          label: PHP
          source: |
            <?php
            $params = http_build_query([
              'number' => '2299775xxxx',
              'type' => 'text',
              'message' => 'Hello from PHP',
              'instance_id' => '609ACF283XXXX',
              'access_token' => '646116c7XXXX'
            ]);
            $url = 'https://api.wachap.com/v1/send?' . $params;
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            curl_close($ch);
            echo $response;
            ?>
        - lang: go
          label: Go
          source: |
            package main
            import (
              "fmt"
              "net/http"
              "net/url"
              "io/ioutil"
            )
            func main() {
              params := url.Values{}
              params.Add("number", "2299775xxxx")
              params.Add("type", "text")
              params.Add("message", "Hello from Go")
              params.Add("instance_id", "609ACF283XXXX")
              params.Add("access_token", "646116c7XXXX")
              resp, err := http.Get("https://api.wachap.com/v1/send?" + params.Encode())
              if err != nil { panic(err) }
              defer resp.Body.Close()
              body, _ := ioutil.ReadAll(resp.Body)
              fmt.Println(string(body))
            }
        - lang: jsx
          label: React
          source: |
            async function sendMessage() {
              const params = new URLSearchParams({
                number: '2299775xxxx',
                type: 'text',
                message: 'Hello from React',
                instance_id: '609ACF283XXXX',
                access_token: '646116c7XXXX',
              });
              const res = await fetch(`https://api.wachap.com/v1/send?${params}`);
              console.log(await res.json());
            }
        - lang: typescript
          label: Next.js
          source: |
            // app/send/page.js
            export default async function Page() {
              const params = new URLSearchParams({
                number: '2299775xxxx',
                type: 'text',
                message: 'Hello from Next.js',
                instance_id: '609ACF283XXXX',
                access_token: '646116c7XXXX',
              });
              const res = await fetch(`https://api.wachap.com/v1/send?${params}`, { cache: 'no-store' });
              const data = await res.json();
              return <pre>{JSON.stringify(data, null, 2)}</pre>;
            }
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Message d’erreur
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````