Beyond real-time assessment, you can stream raw events (from Stripe, MercadoPago, your ledger, etc.) to Clausum. Clausum stores each event and runs your processing rules, optionally opening a case automatically.
This is useful when you want Clausum to react to provider events asynchronously rather than gating each transaction inline.
Endpoint
POST $CLAUSUM_API_BASE/api/webhooks/ingest
Authorization: Bearer clm_wh_xxx
Use an event ingest key (clm_wh_...), not a server key (clm_sk_...) or publishable key (clm_pub_...). Create it under Integrations → API Keys → Event ingest.
Payload
Send any JSON. Clausum reads the event type from event (or type) and the details from data.
{
"event": "fraud_alert",
"data": {
"transaction_id": "txn_123",
"amount": 500000,
"currency": "MXN",
"id": "evt_external_001"
}
}
Example
await fetch(`${process.env.CLAUSUM_API_BASE}/api/webhooks/ingest`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CLAUSUM_WEBHOOK_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
event: "payment.succeeded",
data: { id: "pi_3Nxyz", amount: 89900, currency: "USD", transaction_id: "txn_123" },
}),
})
Response
{
"success": true,
"event_id": "9c1d...",
"message": "Event received and queued for processing"
}
Processing rules
Configure rules in the dashboard to decide what happens to each event. A rule has conditions and an action.
Conditions include:
event_type — match a specific event.
amount_gte / amount_lte — match an amount range (reads data.amount).
Actions include:
| Action | Effect |
|---|
create_expediente | Open a case from the event |
create_alert | Raise an alert |
flag_review | Flag for manual review |
ignore | Take no action |
Rules are evaluated in priority order; the first matching rule runs and processing stops. When no rule matches, the event is simply stored and marked processed.
Use ingestion for asynchronous reactions to provider events. For decisions that gate money movement in real time, use /assess instead.
Forwarding provider webhooks
A common pattern is to forward your PSP’s webhooks straight to Clausum after verifying them on your side:
export async function POST(req: Request) {
const event = await verifyStripeWebhook(req) // your existing verification
await fetch(`${process.env.CLAUSUM_API_BASE}/api/webhooks/ingest`, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.CLAUSUM_SECRET_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ event: event.type, data: event.data.object }),
})
return new Response("ok")
}