> ## 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 une instance

> Crée un nouvel identifiant d'instance WaChap.



## OpenAPI

````yaml /api/openapi.yaml get /create_instance
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:
  /create_instance:
    get:
      tags:
        - Instances
      summary: Créer une instance
      description: Créer un nouvel identifiant d'instance.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: integer
                  message:
                    type: string
                  instance_id:
                    type: string
              examples:
                default:
                  value:
                    status: 200
                    message: Instance créée
                    instance_id: 609ACF283XXXX
        '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/create_instance?access_token=646116c7XXXX"
        - lang: javascript
          label: JavaScript
          source: >
            const params = new URLSearchParams({ access_token: '646116c7XXXX'
            });

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

            const data = await res.json();

            console.log(data);
        - lang: python
          label: Python
          source: >
            import requests

            params = { 'access_token': '646116c7XXXX' }

            r = requests.get('https://api.wachap.com/v1/create_instance',
            params=params)

            print(r.json())
        - lang: php
          label: PHP
          source: >
            <?php

            $url =
            'https://api.wachap.com/v1/create_instance?access_token=646116c7XXXX';

            $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"
              "io/ioutil"
            )
            func main() {
              resp, err := http.Get("https://api.wachap.com/v1/create_instance?access_token=646116c7XXXX")
              if err != nil { panic(err) }
              defer resp.Body.Close()
              body, _ := ioutil.ReadAll(resp.Body)
              fmt.Println(string(body))
            }
        - lang: jsx
          label: React
          source: |
            import { useState } from 'react';
            export default function CreateInstanceButton() {
              const [result, setResult] = useState(null);
              async function handleClick() {
                const params = new URLSearchParams({ access_token: '646116c7XXXX' });
                const res = await fetch(`https://api.wachap.com/v1/create_instance?${params}`);
                setResult(await res.json());
              }
              return (
                <div>
                  <button onClick={handleClick}>Créer l’instance</button>
                  <pre>{JSON.stringify(result, null, 2)}</pre>
                </div>
              );
            }
        - lang: typescript
          label: Next.js
          source: |
            // app/create-instance/page.js (Next.js 13+)
            export default async function Page() {
              const params = new URLSearchParams({ access_token: '646116c7XXXX' });
              const res = await fetch(`https://api.wachap.com/v1/create_instance?${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

````