• GuideBreaking change in 2.0.0: the tax ID is required
  • GuideAccess
  • GuideKey scopes
  • GuideLocking a key to your network addresses
  • GuideErrors
  • GuideRate limits
  • GuideSafe retries (Idempotency-Key)
  • GuidePages
  • GuideWebhooks
  • GuideCheck the signature
  • GuideA receiver to start from
  • GuideSandbox
  • RecipeYour first call in 5 minutesMake a sandbox key and list your merchants.
  • RecipeStart a review and wait for review.readyStart a website review, get told when it is done, read the findings and download the report.
  • RecipeVerify webhook signaturesProve a delivery came from Kvali, answer fast and handle retries once.
  • RecipeSend a merchant's documentsUpload a registration certificate or bank letter in two steps.
  • RecipeMonitoring: checks, changes, alerts, violationsLearn what monitoring found about your live merchants, without missing or repeating a row.
  • RecipeRetries, idempotency, pages and rate limitsA small client that retries safely, pages through lists and stays under the limit.
  • RecipeLock a key to your network addressesMake a stolen key useless outside your own network.
  • RecipeFrom sandbox to liveThe checks to pass in the sandbox, then the switch to production keys.

↑ ↓ to move · Enter to open · Esc to close

Start a review and wait for review.ready

Start a website review, get told when it is done, read the findings and download the report.

15 minScope: reviews

What you get

  • A review started safely (a retry never starts a second one).
  • The result: recommendation, findings with their verbatim quotes, the fix list and the KYC items.
  • The sealed report PDF on your letterhead.
  1. Start the review

    Send the merchant's merchant_id (or a website: Kvali reuses the merchant with that website, or creates one; a new merchant needs its tax ID in registry_id since API 2.0.0, or the call is refused with 422). Always send an Idempotency-Key: if the call times out and you retry with the same key, Kvali answers the first answer again and starts nothing twice. The answer is 202 at once; the review runs in the background, about a minute and a half.

    Request and answer
    curl -X POST "https://aikvali.com/api/v1/reviews" \
      -H "Authorization: Bearer $KVALI_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $(uuidgen)" \
      -d '{"merchant_id":"3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10","kind":"onboarding"}'
  2. Wait for review.ready

    Best: subscribe to the review.ready webhook (and review.failed) in Settings → API → Webhooks. Its data.review.id is the review to read. Without a receiver, poll GET /reviews/{id} every 10 seconds until status is ready or failed.

    Poll, or the webhook's body
    const BASE = "https://aikvali.com/api/v1";
    const headers = { Authorization: "Bearer " + process.env.KVALI_KEY };
    
    async function waitForReview(id) {
      for (;;) {
        const res = await fetch(BASE + "/reviews/" + id, { headers });
        const { data } = await res.json();
        if (data.status === "ready" || data.status === "decided") return data;
        if (data.status === "failed") throw new Error(data.error);
        await new Promise((r) => setTimeout(r, 10_000));
      }
    }
  3. Read the result

    GET /reviews/{id} returns Kvali's recommendation and confidence, and each finding with its severity, the verbatim quote and the page_url it was found on. fix_list is what the merchant should change and kyc_items what to ask the merchant for; add lang=ka or lang=ru for those two in Georgian or Russian. The decision itself is a person's, in Kvali: you learn it from review.decided.

    Code
    curl "https://aikvali.com/api/v1/reviews/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10?lang=en" \
      -H "Authorization: Bearer $KVALI_KEY"
  4. Download the report PDF

    POST /reviews/{id}/report issues the review report as a sealed PDF, the same file as "Download PDF" in Kvali. Each call issues a numbered record, so send an Idempotency-Key. The PDF comes base64 in pdf_base64; anyone can check it at verify_url. 409 means the review isn't finished yet.

    Code
    curl -X POST "https://aikvali.com/api/v1/reviews/3f0c2a52-6a1e-4c1b-9d55-2f7f5b1e9a10/report" \
      -H "Authorization: Bearer $KVALI_KEY" \
      -H "Content-Type: application/json" \
      -H "Idempotency-Key: $(uuidgen)" \
      -d '{"lang":"en"}' \
      | jq -r .data.pdf_base64 | base64 --decode > report.pdf