The answer
Read abstain first, then answer.
Built and tested, not yet deployed. Early access.
On this page
The six fields
decisionstring or nullThe named decision, or
nullfor your own question.typestringpredicate,choiceorscore.answerboolean, string, number or nullPredicate:
trueorfalse. Choice: one option name, a transaction id for receipts and refunds, or"none"when nothing matches. Score: an integer from 0 to 100.nullwhen the model declined.probabilitynumber or nullThe 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.
1when a rule settled the answer.nullwhen the model declined or gave no probability.reasonsarray of stringsCodes 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.abstainbooleanTrue when the probability is under your line, when the model gave no probability for its answer (
answeris 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
{ "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:
{ "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:
{ "decision": "receipt_match", "type": "choice", "answer": "none", "probability": 1, "reasons": ["rule_no_purchases"], "abstain": false }
# The answer
Read `abstain` first, then `answer`.
Built and tested, not yet deployed. Early access.
## The six fields
- `decision` (string or null): The named decision, or `null` for your own question.
- `type` (string): `predicate`, `choice` or `score`.
- `answer` (boolean, 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.
- `probability` (number 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.
- `reasons` (array 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.
- `abstain` (boolean): 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
Response: 200 OK (the probability is a stand-in)
A predicate response:
```
{
"decision": "restricted_merchant",
"type": "predicate",
"answer": true,
"probability": 0.97,
"reasons": [
"mcc_7995",
"rule_gambling_category",
"kind_sportsbook"
],
"abstain": false
}
```
A choice response:
```
{
"decision": "spend_type",
"type": "choice",
"answer": "essential",
"probability": 0.97,
"reasons": ["mcc_5411"],
"abstain": false
}
```
A transaction id response:
```
{
"decision": "receipt_match",
"type": "choice",
"answer": "t1",
"probability": 0.95,
"reasons": [
"amount_exact",
"name_match",
"within_a_day",
"rule_agrees"
],
"abstain": false
}
```
A your own question response:
```
{
"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
```json
{
"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
```json
{
"decision": "receipt_match",
"type": "choice",
"answer": "none",
"probability": 1,
"reasons": ["rule_no_purchases"],
"abstain": false
}
```
Source: /api/docs/answer