Quickstart

Create a session on your server, open the SDK in your page, and receive the borrower's documents.

You need three things from Kita: KITA_BASE_URL, KITA_API_KEY, and your web origin (for example https://app.example.com) registered against that key.

1. Create a session on your server

Use your applicant or loan ID as reference_id. It is stored with everything Kita keeps, so it is how you match results to outcomes later.

Python

import os
from kita_risk import KitaRisk   # one file, standard library only

kita = KitaRisk(api_key=os.environ["KITA_API_KEY"], base_url=os.environ["KITA_BASE_URL"])

def start_upload(loan_id: str) -> dict:
  session = kita.create_session(reference_id=loan_id, origin="https://app.example.com")
  # Only these two values go to the browser. Never the API key.
  return {"session_id": session["session_id"], "client_token": session["client_token"]}
201 Created
{
  "session_id": "rs_3f9a1c2e7b8d4a60915e2c7d4b8a6f01",
  "client_token": "kct_example_8Yq2…",
  "expires_at": "2026-09-18T20:30:00Z",
  "sdk_url": "https://<your-kita-host>/sdk/v1/kita-risk.js",
  "connect_url": "https://<your-kita-host>/connect?session_id=rs_3f9a…",
  "environment": "production"
}

Send only session_id and client_token to the browser. The token lasts 30 minutes and works for this one session, from this one origin. Without a valid API key the call returns 401; see authentication.

2. Open the SDK in your page

<script src="https://<your-kita-host>/sdk/v1/kita-risk.js"></script>
<button id="upload">Upload your documents</button>
<script>
  document.getElementById('upload').onclick = async () => {
    const { session_id, client_token } = await (await fetch('/start-upload', { method: 'POST' })).json();
    KitaRisk.create({
      sessionId: session_id,
      clientToken: client_token,
      onSubmitted: () => showThanks(),       // the borrower finished
      onExit: () => {},                      // the borrower closed it; they can resume
      onError: ({ code }) => console.warn(code),
    }).open();
  };
</script>

3. Know when processing finished

onSubmitted means the borrower is done, not that Kita is. Poll the session from your server, or receive the signed webhook.

status = kita.status(session_id)
status["status"]          # collecting → queued → processing → completed | partial | failed
status["documents"]       # per-file status and detected type

Try it without real documents

In the test environment Kita can enable a sandbox mode that labels every screen as sandbox, so you can build the integration before sharing any borrower data.

On this page