The answer

    Read abstain first, then answer.

    Built and tested, not yet deployed. Early access.

    On this page

    The six fields

    • decisionstring or null

      The named decision, or null for your own question.

    • typestring

      predicate, choice or score.

    • answerboolean, string, number or null

      Predicate: true or false. Choice: one option name, a transaction id for receipts and refunds, or "none" when nothing matches. Score: an integer from 0 to 100. null when the model declined.

    • probabilitynumber or null

      The probability of the answer given. For a predicate answered false it is one minus the probability of true; for a score it is the most likely level’s probability. 1 when a rule settled the answer. null when the model declined or gave no probability.

    • reasonsarray of strings

      Codes for what the answer rests on: rule checks that fired and the model’s sub-answers. Empty for your own question, unless the model declined: then ["model_declined"], as for a named decision.

    • abstainboolean

      True when the probability is under your line, when the model gave no probability for its answer (answer is still set) or when the model declined. Send these cases to a person.

    Every response, errors included, is JSON with cache-control: no-store.

    Four shapes, one code path

    200 OKStand-in probability1

    {
      "decision": "restricted_merchant",
      "type": "predicate",
      "answer": true,
      "probability": 0.97,
      "reasons": [
        "mcc_7995",
        "rule_gambling_category",
        "kind_sportsbook"
      ],
      "abstain": false
    }
    {
      "decision": "spend_type",
      "type": "choice",
      "answer": "essential",
      "probability": 0.97,
      "reasons": ["mcc_5411"],
      "abstain": false
    }
    {
      "decision": "receipt_match",
      "type": "choice",
      "answer": "t1",
      "probability": 0.95,
      "reasons": [
        "amount_exact",
        "name_match",
        "within_a_day",
        "rule_agrees"
      ],
      "abstain": false
    }
    {
      "decision": null,
      "type": "choice",
      "answer": "billing",
      "probability": 0.93,
      "reasons": [],
      "abstain": false
    }

    A score answer is an integer from 0 to 100: the model’s score on your levels, mapped linearly and rounded, so 0 is the first level and 100 the last. The model’s score can fall between two levels; the answer then falls between their points.

    A declined answer

    When the model declines a question, the call still succeeds: HTTP 200, no answer, and abstain true. This is its shape:

    Declined

    200 OK

    {
      "decision": "restricted_merchant",
      "type": "predicate",
      "answer": null,
      "probability": null,
      "reasons": ["model_declined"],
      "abstain": true
    }

    A rule-settled answer

    When a rule settles the decision there’s no model call, and the probability is 1:

    Settled by a rule

    200 OK

    {
      "decision": "receipt_match",
      "type": "choice",
      "answer": "none",
      "probability": 1,
      "reasons": ["rule_no_purchases"],
      "abstain": false
    }