Siftil Documentation PT Sign in Create free account

Webhooks

With a webhook on, every identification sends the whole event to a URL of yours, right after responding to the browser. Use it to feed your database, your SIEM or a review queue without polling the API.

Turning it on

In the dashboard, under Webhook, or through the API:

bash
curl -X PATCH https://siftil.com/v1/account \
  -H 'authorization: Bearer sk_…' -H 'content-type: application/json' \
  -d '{"webhook": "https://api.yourcompany.com/siftil"}'

The URL must be https://. To turn it off, send "webhook": null.

What arrives

http
POST /siftil HTTP/1.1
content-type: application/json
x-siftil-signature: Zq3l0Vd2…

{ "requestId": "…", "visitorId": "…", "suspect": { … }, "signals": { … }, … }

The body is the full event.

Checking the signature

x-siftil-signature = base64url(HMAC-SHA256(token secret, raw body)). Compute it over the exact bytes received, before parsing the JSON.

js
import { createHmac, timingSafeEqual } from 'node:crypto'

app.post('/siftil', express.raw({ type: 'application/json' }), (req, res) => {
  const want = createHmac('sha256', process.env.SIFTIL_TOKEN_SECRET).update(req.body).digest('base64url')
  const got = String(req.get('x-siftil-signature') || '')
  if (want.length !== got.length || !timingSafeEqual(Buffer.from(want), Buffer.from(got))) return res.sendStatus(401)
  const event = JSON.parse(req.body)
  res.sendStatus(204)
  queue.push(event) // process after responding
})
python
import base64, hashlib, hmac

def signature_ok(body: bytes, received: str, secret: str) -> bool:
    calc = base64.urlsafe_b64encode(hmac.new(secret.encode(), body, hashlib.sha256).digest()).rstrip(b'=').decode()
    return hmac.compare_digest(calc, received)

Delivery

Siftil · API v1 documentation