Send a merchant's documents
Upload a registration certificate or bank letter in two steps.
10 minScope: reviewsWhat you get
- A merchant's file in Kvali, shown as "from your system (API)".
- Kvali's document check started on it.
- What the check found, from the merchant.
Ask for an upload address
Send the file's name and size. PDF, Word (.docx), JPG, PNG or WebP, at most 10 MB. The answer has an
upload_id, a one-timeupload_urland thecontent_typeto send.curl -X POST "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents/uploads" \ -H "Authorization: Bearer $KVALI_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"file_name":"registration.pdf","size":482113}'const res = await fetch("https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents/uploads", { method: "POST", headers: { Authorization: `Bearer ${process.env.KVALI_KEY}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "file_name": "registration.pdf", "size": 482113 }), }); if (!res.ok) throw new Error((await res.json()).error.message); const { data } = await res.json();import os, uuid import requests res = requests.post( "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents/uploads", headers={"Authorization": f"Bearer {os.environ['KVALI_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "file_name": "registration.pdf", "size": 482113, }, timeout=30, ) if not res.ok: raise RuntimeError(res.json()["error"]["message"]) data = res.json()["data"]{ "data": { "upload_id": "3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", "upload_url": "https://storage.kvali.example/storage/v1/object/upload/sign/api-uploads/3f0c2a52/registry-extract.pdf?token=eyJhbGciOi", "method": "PUT", "content_type": "application/pdf", "expires_at": "2026-10-22T09:30:00Z" } }PUT the file's bytes
Within 2 hours, PUT the bytes to
upload_urlwith the headerContent-Type: <content_type>. No API key here: the address itself is the permission, for this one file. It is on Kvali's file storage host; if your network only lets known hosts out, allow it too.curl -X PUT "$UPLOAD_URL" \ -H "Content-Type: application/pdf" \ --data-binary @registration.pdfimport { readFile } from "node:fs/promises"; // upload: the data of step 1 const put = await fetch(upload.upload_url, { method: "PUT", headers: { "Content-Type": upload.content_type }, body: await readFile("registration.pdf"), }); if (!put.ok) throw new Error("upload refused: " + put.status);import requests # upload: the data of step 1 with open("registration.pdf", "rb") as f: put = requests.put( upload["upload_url"], headers={"Content-Type": upload["content_type"]}, data=f, timeout=120, ) put.raise_for_status()Confirm the upload
Confirm with the
upload_idand the document'skind. Kvali checks the bytes, keeps the file in your organisation's private folder and starts its document check (202). The same file twice is kept once (created: false).409means nothing was uploaded yet, the upload expired, or it was already confirmed.curl -X POST "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents" \ -H "Authorization: Bearer $KVALI_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{"upload_id":"3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10","kind":"registration_certificate"}'const res = await fetch("https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents", { method: "POST", headers: { Authorization: `Bearer ${process.env.KVALI_KEY}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() }, body: JSON.stringify({ "upload_id": "3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", "kind": "registration_certificate" }), }); if (!res.ok) throw new Error((await res.json()).error.message); const { data } = await res.json();import os, uuid import requests res = requests.post( "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/documents", headers={"Authorization": f"Bearer {os.environ['KVALI_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "upload_id": "3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", "kind": "registration_certificate", }, timeout=30, ) if not res.ok: raise RuntimeError(res.json()["error"]["message"]) data = res.json()["data"]{ "data": { "document_id": "3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", "created": true, "kind": "registration_certificate", "file_name": "registry-extract.pdf", "size_bytes": 482113, "sha256": "9f2c4e1a", "check": "started" } }Read what the check found
A minute later,
GET /merchants/{id}lists the merchant'sdocuments, each with itscheck, thesignalsread and anyproblemsfound against what Kvali holds.curl "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10" \ -H "Authorization: Bearer $KVALI_KEY"const res = await fetch("https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", { headers: { Authorization: `Bearer ${process.env.KVALI_KEY}` }, }); if (!res.ok) throw new Error((await res.json()).error.message); const { data } = await res.json();import os import requests res = requests.get( "https://aikvali.com/api/v1/merchants/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10", headers={"Authorization": f"Bearer {os.environ['KVALI_KEY']}"}, timeout=30, ) if not res.ok: raise RuntimeError(res.json()["error"]["message"]) data = res.json()["data"]