Quickstart

    Built and tested, not yet deployed. Early access.

    On this page

    Get early access

    Tell us what you’d decide first, or write to hello@theunderstanding.company. Your key, your base URL and examples for your stack arrive when your access opens.

    Get early access

    Set two environment variables

    The base URL arrives with your access, and you make your key in the console. Keep both on your server.

    Bash
    export UNDERSTANDING_API_URL="<your base URL>"
    export UNDERSTANDING_API_KEY="<your key>"

    Make your first call

    Ask whether a merchant is a gambling business. Any HTTP client works; there’s no SDK yet.

    curl "$UNDERSTANDING_API_URL/v1/understand" \
      -H "Authorization: Bearer $UNDERSTANDING_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "decision": "restricted_merchant",
        "input": { "merchant": "DRAFTKINGS", "mcc": "7995" }
      }'
    const base = process.env.UNDERSTANDING_API_URL;
    const key = process.env.UNDERSTANDING_API_KEY;
    
    const body = {
      decision: "restricted_merchant",
      input: { merchant: "DRAFTKINGS", mcc: "7995" },
    };
    
    const res = await fetch(`${base}/v1/understand`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${key}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify(body),
    });
    const result = await res.json();
    import os
    import requests
    
    base = os.environ["UNDERSTANDING_API_URL"]
    key = os.environ["UNDERSTANDING_API_KEY"]
    
    body = {
        "decision": "restricted_merchant",
        "input": {"merchant": "DRAFTKINGS", "mcc": "7995"},
    }
    
    res = requests.post(
        f"{base}/v1/understand",
        headers={"Authorization": f"Bearer {key}"},
        json=body,
        timeout=10,
    )
    result = res.json()
    Response

    200 OKStand-in probability1

    {
      "decision": "restricted_merchant",
      "type": "predicate",
      "answer": true,
      "probability": 0.97,
      "reasons": [
        "mcc_7995",
        "rule_gambling_category",
        "kind_sportsbook"
      ],
      "abstain": false
    }
    • answer: true, it is a gambling business.
    • probability: how likely that answer is, by the model.
    • reasons: the category code, the rule check that fired and the kind of business.
    • abstain: false, the probability is over the default line of 0.8.

    Read about the six fields

    Act on abstain

    When abstain is true, send the case to a person; otherwise use the answer. This replaces the call in step 3 and uses its base and key.

    // sendToReview and applyDecision are your own functions
    const payload = { merchant: "LUCKY COINS LLC", mcc: "5816" };
    
    const res = await fetch(`${base}/v1/understand`, {
      method: "POST",
      headers: {
        Authorization: `Bearer ${key}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ decision: "restricted_merchant", input: payload }),
    });
    const result = await res.json();
    if (!res.ok) throw new Error(`${res.status}: ${result.error.message}`);
    
    if (result.abstain) {
      await sendToReview({ decision: result.decision, reasons: result.reasons, input: payload });
    } else {
      await applyDecision(result.answer);
    }
    # send_to_review and apply_decision are your own functions
    payload = {"merchant": "LUCKY COINS LLC", "mcc": "5816"}
    
    res = requests.post(
        f"{base}/v1/understand",
        headers={"Authorization": f"Bearer {key}"},
        json={"decision": "restricted_merchant", "input": payload},
        timeout=10,
    )
    result = res.json()
    if not res.ok:
        raise RuntimeError(f"{res.status_code}: {result['error']['message']}")
    
    if result["abstain"]:
        send_to_review(decision=result["decision"], reasons=result["reasons"], input=payload)
    else:
        apply_decision(result["answer"])

    Send unclear cases to a person

    Next steps