Avistadocs

Listar webhooks da conta

GET /api/webhooks

GET https://api.avista.global/api/webhooks

Requer um Bearer token no header Authorization. Veja Gerar Token para obter um.

Retorna todos os webhooks configurados para a conta autenticada.

Autenticação

Requer token Bearer no header Authorization.


Exemplos de Código

cURL
curl -X GET "https://api.avista.global/api/webhooks" \
  -H "Authorization: Bearer $AVISTA_TOKEN"
const axios = require('axios');

const response = await axios.get('https://api.avista.global/api/webhooks', {
  headers: { 'Authorization': `Bearer ${process.env.AVISTA_TOKEN}` },
});
console.log(response.data);
import os, requests

response = requests.get(
    'https://api.avista.global/api/webhooks',
    headers={'Authorization': f'Bearer {os.environ["AVISTA_TOKEN"]}'},
)
print(response.json())
$ch = curl_init('https://api.avista.global/api/webhooks');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('AVISTA_TOKEN'),
    ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.avista.global/api/webhooks"))
    .header("Authorization", "Bearer " + System.getenv("AVISTA_TOKEN"))
    .GET()
    .build();
HttpResponse<String> response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Response (200)

CampoTipoDescrição
accountIdnumberID da conta
webhooksarrayLista de webhooks configurados
webhooks[].idnumberIdentificador único do webhook
webhooks[].typestringTipo do evento: cash_in, cash_out, refund_in, refund_out, med_created, med_accepted, med_rejected
webhooks[].urlstringURL do endpoint configurado
webhooks[].headersobjectHeaders customizados (chave-valor)
webhooks[].isActivebooleanIndica se o webhook está ativo
webhooks[].createdAtstringData de criação (ISO 8601)
totalnumberTotal de webhooks configurados
{
  "accountId": 93,
  "webhooks": [
    {
      "id": 1,
      "type": "cash_in",
      "url": "https://api.example.com/webhooks/pix",
      "headers": {
        "Authorization": "Bearer token123"
      },
      "isActive": true,
      "createdAt": "2025-01-09T12:00:00.000Z"
    }
  ],
  "total": 4
}

Erros

StatusDescrição
401Token não fornecido ou inválido
404Conta não encontrada

Nesta página