Examples
Integration examples
Copy-paste examples for the most common integration patterns. All examples use Authorization: Bearer kc_live_YOUR_KEY.
// Shopify order webhook handler (Node.js)
app.post('/webhooks/orders/create', async (req, res) => {
const order = req.body;
const domain = order.email.split('@')[1];
const { score, verdict } = await kc.check({ domain });
if (verdict === 'BLOCK') {
await shopify.cancelOrder(order.id, {
reason: 'fraud',
note: `Kairos score: ${score}`
});
return res.json({ cancelled: true, score });
}
res.json({ fulfilled: true, score });
});
// Before creating a PaymentIntent
async function createPayment(email, amount) {
const domain = email.split('@')[1];
const { verdict, score } = await kc.check({ domain });
if (verdict === 'BLOCK') {
throw new Error(`Payment blocked (risk score: ${score})`);
}
return stripe.paymentIntents.create({
amount,
currency: 'eur',
receipt_email: email,
metadata: { kairos_score: score, kairos_verdict: verdict }
});
}
// supabase/functions/validate-signup/index.ts
import { serve } from 'https://deno.land/std/http/server.ts';
serve(async (req) => {
const { email } = await req.json();
const domain = email.split('@')[1];
const res = await fetch('https://kairoscheck.net/api/check', {
method: 'POST',
headers: {
'Authorization': `Bearer ${Deno.env.get('KAIROS_KEY')}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ domain })
});
const { verdict } = await res.json();
if (verdict === 'BLOCK') {
return new Response(JSON.stringify({ error: 'Signup denied' }), {
status: 400
});
}
return new Response(JSON.stringify({ ok: true }));
});
// Vanilla JS — runs on form submit
document.getElementById('signup-form')
.addEventListener('submit', async (e) => {
e.preventDefault();
const email = document.getElementById('email').value;
const res = await fetch('/api/check-domain', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ domain: email.split('@')[1] })
});
const { verdict } = await res.json();
if (verdict === 'BLOCK') {
showError('This email address cannot be used.');
return;
}
e.target.submit(); // proceed
});
// cron.js — schedule with node-cron or Railway cron
import cron from 'node-cron';
import { KairosCheck } from '@kairoscheck/sdk';
const kc = new KairosCheck({ apiKey: process.env.KAIROS_KEY });
cron.schedule('0 2 * * *', async () => {
const customers = await db.getActiveCustomers();
for (const c of customers) {
const { score, verdict } = await kc.check({
domain: c.email.split('@')[1]
});
if (verdict === 'BLOCK' && c.riskLevel !== 'high') {
await db.setRiskLevel(c.id, 'high', score);
await slack.alert(`⚠️ Customer ${c.id} flagged (score ${score})`);
}
}
});
Ready to integrate?
Get your API key and be in production in under 30 minutes.
Get API key — €29 →