Server API
Sessions, client tokens, status, results, deletion and webhooks. Called from your backend with your API key.
All requests go to KITA_BASE_URL with your key in X-API-Key. Responses are
JSON. Errors have the shape {"error": {"code": "...", "request_id": "req_..."}};
quote the request_id when you contact Kita.
Authentication
Send your key in the X-API-Key header on every request. Keys are per
organization and per environment: risk_test_… for test, risk_live_… for
production. Nothing in the API is readable without one, and the key is checked
before the request body is.
| Status | Code | Meaning |
|---|---|---|
| 401 | missing_api_key | No X-API-Key header. |
| 401 | invalid_api_key | The key matches no organization. Check for a truncated or rotated key. |
| 401 | wrong_environment | A test key sent to production, or a live key sent to test. |
Keep the key on your server. The browser and the mobile app only ever receive a
client_token, which is limited to one session and one origin and expires after
30 minutes.
Python client
kita_risk.py is a single file with no dependencies. Copy it into your project.
Getting the file
Download kita_risk.py. It wraps exactly the
endpoints below, so any language with an HTTP client works the same way.
Create a session
POST /v1/risk/sessions
| Field | Type | Required | Description |
|---|---|---|---|
reference_id | string, 1–128 | yes | Your applicant or loan ID. Stored with everything Kita keeps for the session. |
origin | string | yes | The exact web origin that embeds the SDK. Must be registered with Kita. For Android, the origin you load the host page under. |
display_name | string, 1–60 | no | Your name as shown to the borrower. Default "Your lender". |
country | MX or PH | no | Default MX. Must match the model profile enabled for you. |
location | optional or disabled | no | Whether the flow may ask for browser location. Default optional. Location is never a model input. |
Send an Idempotency-Key header (up to 128 characters) derived from the
applicant. A repeat with the same key and body returns the same session with a
new client token; the old token stops working. A repeat with a different body
returns 409 idempotency_conflict.
Returns 201 with session_id, client_token, expires_at, sdk_url,
connect_url and environment.
New client token
POST /v1/risk/sessions/{session_id}/client-token
Issues a fresh 30-minute token and invalidates the previous one.
Session status
GET /v1/risk/sessions/{session_id} · GET /v1/risk/sessions?offset=0 (40 per page, newest first)
status | Meaning |
|---|---|
collecting | The borrower has not shared yet. Files can still be added or removed. |
queued, processing | Shared. Kita is reading the files. |
completed | Every file was read. |
partial | Some files were read; the rest have a reason. |
failed | No file could be read. |
Results
GET /v1/risk/sessions/{session_id}/results returns 409 results_not_ready
until the session is completed, partial or failed.
For live scoring the response lists each score with status, value,
percentile and the document it came from; see
the scores. Scores that do not apply to the uploaded
document types are null, never zero.
For a backtest every score is returned as unavailable with reason
withheld_for_backtest. The response still tells you which files were read and
their detected types.
Delete a session
DELETE /v1/risk/sessions/{session_id} returns 204. It removes the session,
its files and results, and the copy in Kita's archive. If the archive cannot be
reached the call returns 503 archive_unavailable and nothing is removed, so you
can retry. Use this to honor a borrower's deletion request.
Webhooks
When a session finishes, Kita posts to the HTTPS URL you registered:
type is risk.session.completed, .partial or .failed. The body never
contains scores or borrower data; fetch what you need with your API key.
Verify every delivery. The Kita-Signature header is
t=<unix seconds>,v1=<hex> where v1 is HMAC-SHA256 of t + "." + raw_body
under your webhook secret. Reject timestamps older than five minutes and
deduplicate on id. Return any 2xx once you have stored the event. Failed
deliveries retry with backoff, six attempts in all.
Limits
| Write requests | 120 per minute per organization, in bursts of up to 30. 429 carries Retry-After. |
| File size | 100 MB per file |
| Files per session | 12 |
| PDF pages | 150 per file |
| Client token lifetime | 30 minutes |
| Session retention | 24 hours unless agreed otherwise |


