Listar webhooks de la cuenta
GET /api/webhooks
GET https://api-pay.brasilbitco.in/api/webhooksRequiere un Bearer token en el header Authorization. Vea Generar Token para obtener uno.
Retorna todos los webhooks configurados para la cuenta autenticada.
Autenticación
Requiere un Bearer token en el header Authorization.
Ejemplos de Código
curl -X GET "https://api-pay.brasilbitco.in/api/webhooks" \
-H "Authorization: Bearer $BRBTC_TOKEN"const axios = require('axios');
const response = await axios.get('https://api-pay.brasilbitco.in/api/webhooks', {
headers: { 'Authorization': `Bearer ${process.env.BRBTC_TOKEN}` },
});
console.log(response.data);import os, requests
response = requests.get(
'https://api-pay.brasilbitco.in/api/webhooks',
headers={'Authorization': f'Bearer {os.environ["BRBTC_TOKEN"]}'},
)
print(response.json())$ch = curl_init('https://api-pay.brasilbitco.in/api/webhooks');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('BRBTC_TOKEN'),
],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api-pay.brasilbitco.in/api/webhooks"))
.header("Authorization", "Bearer " + System.getenv("BRBTC_TOKEN"))
.GET()
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());Respuesta (200)
| Campo | Tipo | Descripción |
|---|---|---|
accountId | number | ID de la cuenta |
webhooks | array | Lista de webhooks configurados |
webhooks[].id | number | Identificador único del webhook |
webhooks[].type | string | Tipo de evento: cash_in, cash_out, refund_in, refund_out, med_created, med_accepted, med_rejected |
webhooks[].url | string | URL del endpoint configurado |
webhooks[].headers | object | Headers personalizados (clave-valor) |
webhooks[].isActive | boolean | Indica si el webhook está activo |
webhooks[].createdAt | string | Fecha de creación (ISO 8601) |
total | number | Cantidad total 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"
},
{
"id": 2,
"type": "cash_in",
"url": "https://backup.example.com/webhooks/pix",
"headers": {},
"isActive": true,
"createdAt": "2025-01-10T09:15:00.000Z"
},
{
"id": 3,
"type": "cash_out",
"url": "https://api.example.com/webhooks/pix",
"headers": {
"Authorization": "Bearer token123"
},
"isActive": true,
"createdAt": "2025-01-09T12:00:00.000Z"
}
],
"total": 3
}Un mismo type puede tener varias entradas activas (hasta 3), cada una con su propia url, headers e isActive — reflejo del soporte para múltiples URLs por evento.
Errores
| Estado | Descripción |
|---|---|
| 401 | Token faltante o inválido |
| 404 | Cuenta no encontrada |