Webhooks

En vez de pollear la API, suscribite a eventos: allyc hace POST a tu endpoint cuando pasa algo en el lake. Cada entrega llega firmada.

Eventos disponibles

ParámetroTipoDescripción
quote.updatedeventoCambió el precio de un instrumento que seguís.
account.movementeventoSe liquidó un movimiento en un comitente sincronizado.
sync.completedeventoUn conector terminó una corrida de sincronización.

Registrar un endpoint

terminal
curl -X POST "https://allyc.lat/api/v1/webhooks" \
-H "x-api-key: allyc_demo_2026_k7m2p9x4" \
-H "Content-Type: application/json" \
-d '{
"url": "https://tu-sistema.com/hooks/allyc",
"events": ["account.movement", "sync.completed"]
}'

La respuesta incluye el secret del endpoint — se muestra una sola vez y es lo que te permite verificar que cada entrega vino de allyc.

Verificar la firma

Cada POST llega con el header allyc-signature: HMAC-SHA256 del body crudo, con tu secret como clave. Verificá SIEMPRE antes de procesar:

handler.ts
import { createHmac, timingSafeEqual } from "node:crypto";
export async function POST(req: Request) {
const raw = await req.text(); // el body CRUDO, antes de parsear
const expected = "sha256=" + createHmac("sha256", process.env.ALLYC_WEBHOOK_SECRET!)
.update(raw)
.digest("hex");
const received = req.headers.get("allyc-signature") ?? "";
const valid =
expected.length === received.length &&
timingSafeEqual(Buffer.from(expected), Buffer.from(received));
if (!valid) return new Response("firma inválida", { status: 401 });
const event = JSON.parse(raw);
// procesá event.event / event.data acá — y respondé 2xx rápido
return new Response("ok");
}

Entregas y reintentos

Esperamos un 2xx en menos de 10 segundos. Si tu endpoint falla, reintentamos con backoff exponencial (hasta 5 intentos). Todas las entregas quedan visibles en el backoffice con su status y cantidad de intentos. En la demo, las entregas se simulan y se registran sin hacer el POST saliente — el payload y la firma son los reales.

Ejemplo de payload

account.movement
{
"event": "account.movement",
"data": {
"account": "10241",
"type": "COMPRA",
"ticker": "AL30",
"quantity": 150,
"amount": 16867500.00,
"currency": "ARS",
"settled_at": "2026-08-28T14:30:00Z"
}
}