Understanding API docs

    One endpoint for bounded money decisions. Send a decision and its input; get back an answer, its probability, reason codes and a flag that hands unclear cases to a person.

    Built and tested, not yet deployed. Early access.

    On this page

    An example call

    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
    }

    Start here

    Decisions

    The four decisions with a page here
    DecisionWhat it answersAnswers
    Restricted merchantIs this merchant a gambling or wagering business?true or false
    Spend typeIs spending in this category essential, discretionary or neutral?essential, discretionary or neutral
    Receipt to chargeWhich one card charge paid for this receipt?a transaction id, or "none"
    Refund to purchaseWhich transaction refunds this purchase?a transaction id, or "none"

    Five more are built

    Connect

    Reference

    More resources