waiaconnect

Documentação / Essencial

Autenticação

GET /v1/connections

Markdown

Toda chamada a /v1 leva o header Authorization: Bearer <sua API key>. A key tem o formato wc_live_… e é criada no painel (API keys). Ela é mostrada UMA única vez ao ser criada — guarde-a. Se faltar ou for inválida, a API responde 401 com code API_KEY_MISSING (header ausente/malformado, bug de integração) ou API_KEY_INVALID (key inválida ou revogada → gire-a no painel).

# Every /v1 request needs: Authorization: Bearer <your API key>.
# A missing/invalid key → 401 { "error": { "code": "API_KEY_MISSING" | "API_KEY_INVALID" } }
curl https://api.waiaconnect.com/v1/connections \
  -H "Authorization: Bearer wc_live_YOUR_API_KEY"
const res = await fetch("https://api.waiaconnect.com/v1/connections", {
  headers: { "Authorization": "Bearer wc_live_YOUR_API_KEY" }
});
if (res.status === 401) throw new Error("Check/rotate your API key in the panel");
console.log(await res.json()); // { connections: [ { id: "conn_…", … } ] }
<?php
$ch = curl_init("https://api.waiaconnect.com/v1/connections");
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer wc_live_YOUR_API_KEY"],
]);
$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($code === 401) { throw new Exception("Check/rotate your API key in the panel"); }
echo $body;
import requests
res = requests.get("https://api.waiaconnect.com/v1/connections",
  headers={"Authorization": "Bearer wc_live_YOUR_API_KEY"})
res.raise_for_status()  # 401 → check/rotate your API key in the panel
print(res.json())  # {"connections": [{"id": "conn_…", ...}]}

O code é o contrato (para o seu switch); a message em inglês é ajuda para humanos.

A API key nunca aparece nesta tela: ela fica com hash do lado do servidor. Copie a sua em API keys.