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

# Utilisation

> Guides généraux d’utilisation de l’API

## Utilisation

Incluez votre SK dans le header `Authorization` avec le format Bearer de toutes vos requêtes :

```http theme={null}
Authorization: Bearer token
```

### Exemples de requêtes

<CodeGroup>
  ```bash BASH theme={null}
  curl --request GET \
    --url https://api.wachap.com/v1/whatsapp/accounts \
    --header 'Authorization: Bearer token'
  ```

  ```javascript JAVASCRIPT theme={null}
  const sk = 'token';

  const response = await fetch('https://api.wachap.com/v1/whatsapp/accounts', {
    headers: {
      'Authorization': `Bearer ${sk}`
    }
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python PYTHON theme={null}
  import requests

  url = "https://api.wachap.com/v1/whatsapp/accounts"

  headers = {
      "Authorization": "Bearer token"
  }

  response = requests.get(url, headers=headers)

  print(response.json())
  ```

  ```php PHP theme={null}
  <?php

  $curl = curl_init();

  curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.wachap.com/v1/whatsapp/accounts",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => [
      "Authorization: Bearer token"
    ],
  ]);

  $response = curl_exec($curl);
  $err = curl_error($curl);

  curl_close($curl);

  if ($err) {
    echo "cURL Error #:" . $err;
  } else {
    echo $response;
  }
  ```
</CodeGroup>

<Warning>
  **Sécurité**

  * Ne partagez jamais votre SK
  * Ne la committez pas dans votre code source
  * Utilisez des variables d'environnement pour la stocker
  * Régénérez-la si elle est compromise
</Warning>
