Quickstart: Hosted Intake
Create a hosted intake session, redirect the applicant, and read the resulting case file
Overview
Use Hosted Intake when Klarefi should run the applicant-facing flow. Your backend creates a session, redirects the applicant to a signed URL, and then uses webhooks or case reads to consume the result.
Typical Fit
- You want a hosted applicant-facing intake flow.
- You want Klarefi to manage document collection and follow-up questions.
- You want operators to review the resulting case in Klarefi.
Basic Flow
- Create an intake session.
- Redirect the applicant to the signed hosted URL.
- Receive webhook events or poll case state.
- Read the case or case package when it is ready for review.
Create A Session
Install the TypeScript SDK:
npm install @klarefi/nodeCreate sessions from trusted server-side code:
import { Klarefi } from "@klarefi/node";
const klarefi = new Klarefi({
apiKey: process.env.KLAREFI_API_KEY!,
});
const session = await klarefi.sessions.create({
case_type_id: "motor_claim",
idempotency_key: "session_2026_05_01_001",
external_case_id: "claim_12345",
external_applicant_id: "applicant_789",
ttl_hours: 168,
locale: "nl",
});The same request over HTTP:
POST /api/v1/sessions
Authorization: Bearer sk_live_...
Content-Type: application/json
{
"case_type_id": "motor_claim",
"idempotency_key": "session_2026_05_01_001",
"external_case_id": "claim_12345",
"external_applicant_id": "applicant_789",
"ttl_hours": 168,
"locale": "nl"
}Example response:
{
"session_id": "550e8400-e29b-41d4-a716-446655440000",
"signed_url": "https://app.klarefi.com/s/550e8400...?token=...",
"expires_at": "2026-01-22T10:30:00Z",
"idempotent_replay": false
}Redirect The Applicant
Send the applicant to the returned signed_url. From there, Klarefi owns the
hosted intake flow, including structured sections, uploads, and follow-up
questions.
return Response.redirect(session.signed_url, 303);For a quick local check:
npx klarefi sessions create \
--case-type motor_claim \
--external-case-id claim_12345 \
--url-onlyConsume The Result
After the applicant submits the hosted intake, consume:
- webhook events for state changes
- case reads for current case state
- case packages for review-ready handoff material
The case is the result. Hosted Intake does not produce a separate output model.
const caseFile = await klarefi.cases.retrieve(session.session_id);
const pkg = await klarefi.cases.getPackage(session.session_id);