LIQUID Documentation

Documentation library

Events and webhooks

Use the event feed for the records visible to your appointment. A sandbox payment event can reference a simulated cash decision. To close a payment, reconcile the bank journals and the authoritative cash reference for that environment.

Read them

curl -s "$LIQUID_API/v1/engine/events" -H "authorization: Bearer $TOKEN" | jq '.[-5:]'
curl -sN "$LIQUID_API/v1/engine/stream" -H "authorization: Bearer $TOKEN"

Get them pushed (webhooks)

curl -s "$LIQUID_API/v1/webhooks" -H "authorization: Bearer $TOKEN" -H 'content-type: application/json' \
  -d '{"url":"https://your-system.example/liquid","types":["payment","escrow"]}'

The answer includes your webhook's secret, shown once. Then:

Call Does
POST /v1/webhooks/{id}/test Sends a test delivery
GET /v1/webhooks/{id}/deliveries The last 50 deliveries and their results
PATCH /v1/webhooks/{id} {"status":"disabled"} Turns it off

Types: org, connect, counterparty, contract, escrow, payment, payorder, market. Leave types out to get all.

Check every delivery

Each delivery has liquid-signature: t=<seconds>,v1=<hex>, where v1 is HMAC-SHA256 of t + . + the raw body, keyed with your secret.

import { createHmac, timingSafeEqual } from "node:crypto";
function verify(rawBody, header, secret) {
  const match = /^t=([0-9]{1,12}),v1=([0-9a-f]{64})$/.exec(header ?? "");
  if (!match || Math.abs(Date.now() / 1000 - Number(match[1])) > 300) return false;
  const expected = createHmac("sha256", secret).update(match[1] + ".").update(rawBody).digest();
  return timingSafeEqual(expected, Buffer.from(match[2], "hex"));
}
import hashlib, hmac, re, time

def verify(raw_body: bytes, header: str, secret: str) -> bool:
    match = re.fullmatch(r"t=([0-9]{1,12}),v1=([0-9a-f]{64})", header or "")
    if not match or abs(time.time() - int(match[1])) > 300:
        return False
    signed = (match[1] + ".").encode("ascii") + raw_body
    expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, match[2])

Delivery rules