Assess an invoice against the policy without saving
LogsPOST /leak-allowances/assess
Runs the policy against the invoice named by invoice_id and returns the outcome without saving anything. When the invoice is eligible, the result holds the consumption, historic average, excess volume and value, and the proposed credit. Otherwise it gives a reason_code: policy_disabled, invoice_not_open, repair_window_expired, cooldown_active, insufficient_history, below_excess_threshold or no_credit_value. It also says whether proof of repair will be required. Needs the business:leak-allowances:read scope.
Returns
200 OK
Show attributes
invoice_ideligiblereason_codeStable refusal code for an ineligible invoice; clients translate the value.
one of
policy_disabled,invoice_not_open,repair_window_expired,cooldown_active,insufficient_history,below_excess_threshold,no_credit_valueconsumption_m3historic_avg_m3excess_m3excess_value_centsproposed_credit_centscurrencyrequire_proof
Errors 400
Permissions business:leak-allowances:read · Roles: admin, analyst, customer_service, finance, operations, owner, viewer
curl -X POST "$BUSINESS_API/leak-allowances/assess" \
-H "Authorization: Bearer sk_test_..." \
-H "Content-Type: application/json" \
-d '{}'
# No matching CLI command; use cURL or direct HTTP.
const res = await fetch("$BUSINESS_API/leak-allowances/assess", {
method: "POST",
headers: {
Authorization: "Bearer sk_test_...",
"Content-Type": "application/json"
},
body: JSON.stringify({})
});
const data = await res.json();
import requests
res = requests.post(
"$BUSINESS_API/leak-allowances/assess",
headers={
"Authorization": "Bearer sk_test_..."
},
json={}
)
data = res.json()
body := strings.NewReader(`{}`)
req, _ := http.NewRequest("POST", "$BUSINESS_API/leak-allowances/assess", body)
req.Header.Set("Authorization", "Bearer sk_test_...")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
{
"invoice_id": "inv_2jnourvAGxXMMd5IyFbwc1LqUX1",
"eligible": true,
"reason_code": "policy_disabled",
"consumption_m3": 13.42,
"historic_avg_m3": 1,
"excess_m3": 1,
"excess_value_cents": 1342,
"proposed_credit_cents": 1,
"currency": "MZN",
"require_proof": true
}