Self-hosted
For teams that need no data to leave their own infrastructure (banks, hospitals, government), Siftil also runs as a library on your server, under the Scale plan's commercial license. It is the same engine as Siftil Cloud.
What changes
| Siftil Cloud | self-hosted | |
|---|---|---|
| Where it runs | Cloudflare edge | Node 18+, Cloudflare Workers, Vercel, Deno, Bun |
| Database | ours | yours (Postgres, SQLite, Redis, D1, or the in-memory store for testing) |
| Full JA4 and HTTP/2 | Cloudflare's cipher hash | JA4, JA3 and Akamai HTTP/2 fingerprint, if Node terminates TLS |
| IP lists | refreshed by us every 6 h | fetchIpLists() in your cron |
| Cross-account reputation | yes | no (your data only) |
| Score weights | fixed | change any of them |
| Trusted networks | learned | learned + trustedNetworks (CIDR and ASN) |
Usage
import { createSiftil, MemoryStore, fetchIpLists } from 'siftil/server'
const siftil = createSiftil({
store: new MemoryStore(), // in production: SqliteStore (siftil/node) or an EventStore over your database
secret: process.env.SIFTIL_SECRET, // signs challenges and tokens
sealKey: process.env.SIFTIL_SEAL, // optional: sealed result
ipLists: async () => cache.get('iplists') ?? (await fetchIpLists()),
trustedNetworks: { cidrs: ['200.144.0.0/16'], asns: [28571] }, // hospitals and companies you serve
weights: { incognito: 0, latency: 6 }, // tune the score
webhook: { url: 'https://api.yourcompany.com/siftil', secret: process.env.SIFTIL_WEBHOOK },
})
// routes the agent calls (endpoint: '/siftil')
app.get('/siftil/challenge', async (req, res) => res.json(await siftil.challenge(req.ip)))
app.get('/siftil/ping', (req, res) => res.set('timing-allow-origin', '*').send('1'))
app.post('/siftil/identify', async (req, res) => {
const { event, token, sealed } = await siftil.handle({ payload: req.body, headers: req.headers, ip: req.ip })
res.json({ requestId: event.requestId, visitorId: event.visitorId, token, sealed, suspect: { score: event.suspect.score, risk: event.suspect.risk } })
})In the browser, the agent points at your server: Siftil.identify({ endpoint: '/siftil' }), without apiKey.
Store
Any database works. MemoryStore (testing, single process) and SqliteStore (Node, siftil/node) come ready. For another database, the EventStore interface has seven methods: find(bands), get(id), put(visitor, bands), putEvent(e), getEvent(requestId), events({ visitorId?, ip?, since, limit }) and useNonce(n, exp). Siftil Cloud uses the same interface over D1; its code ships with the license as a reference.
Library API
| Function | What it does |
|---|---|
siftil.challenge(ip) | Issues the challenge. |
siftil.handle({ payload, request | headers, ip, cf, edge, linkedId }) | Identifies and returns { event, token, sealed }. |
siftil.event(requestId) | Full event. |
siftil.history(visitorId) | Visitor history. |
siftil.recent(since, limit) | Recent events. |
siftil.related(visitorId) | The same device in other browsers. |
verifyToken(token, secret), unseal(sealed, key) | Backend checks. |
train(samples), predict(model, reasons) | Model trained on your labels. |
Contact us for the license and the package.
Siftil · API v1 documentation