Getting Started: Mode 1 (Session Redirect)
Create an intake session, redirect the claimant, and receive results via webhook
Overview
Mode 1 lets you create intake sessions via API and redirect claimants to Klarefi's hosted intake form. Klarefi handles the conversation, document collection, and extraction. You receive results via webhook when the session completes.
Prerequisites
- A Klarefi API key (
sk_live_...orsk_test_...) - At least one case type configured in the dashboard
- A webhook endpoint to receive results (optional but recommended)
Step 1: Install the SDK
TypeScript
npm install @klarefi/sdkPython
pip install klarefiStep 2: Create a Session
TypeScript
import { KlarefiClient } from "@klarefi/sdk";
const klarefi = new KlarefiClient({
apiKey: "sk_live_your_api_key",
});
const session = await klarefi.createSession({
case_type_id: "motor_claim",
ttl_hours: 168, // 7 days
locale: "nl",
});
console.log("Redirect claimant to:", session.signed_url);
// session.session_id can be stored in your database for trackingPython
from klarefi import KlarefiClient
client = KlarefiClient(api_key="sk_live_your_api_key")
session = client.create_session(
case_type_id="motor_claim",
ttl_hours=168,
locale="nl",
)
print("Redirect claimant to:", session["signed_url"])Step 3: Redirect the Claimant
Use the signed_url from the response to redirect the claimant:
<!-- Option 1: JavaScript redirect -->
<script>
window.location.href = "https://app.klarefi.com/s/...?token=...";
</script>
<!-- Option 2: Server-side redirect (Express) -->app.get("/start-claim", async (req, res) => {
const session = await klarefi.createSession({
case_type_id: "motor_claim",
});
res.redirect(session.signed_url);
});Step 4: Receive Results via Webhook
When the session completes, Klarefi sends a webhook to your registered endpoint:
{
"event": "case.completed",
"case_id": "case_abc123",
"org_id": "org_xyz",
"timestamp": "2026-01-15T10:30:00Z",
"data": {
"features": {
"incident_date": {
"decision": { "decision": "keep" },
"candidates": [{ "value_normalized": "2023-02-03" }]
}
}
}
}See the Webhook Setup Guide for verification details.