View as Markdown

Authorize · Guide

Get rule suggestions

Use rule suggestions to find checkout rules your own orders argue for. Provenance looks for groups of orders where chargebacks, fraud and other bad outcomes cluster, and drafts up to three rules from them. Each draft comes with the numbers behind it and a backtest over your last 30 days. Nothing changes until a person tries the draft in shadow mode and publishes it.

Before you begin: a store sending orders to Provenance (assess checkouts or hold Shopify orders), and a key with the authorize scope. Rule drafts are on the Pro plan and above, with a few drafts during the Free trial; the monthly draft limit per plan is on the pricing page. An owner or admin turns the assist on first, in Account → AI assists (AI assists).

export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x

How a draft is made

Statistics compute every number; a model only picks and names.

StepWho does itWhat happens
Label ordersStatisticsEach order in the last 90 days gets the worst label its sources give (below).
Check the floorStatisticsAt least 200 orders spanning at least 2 weeks, with at least 5 disputed or flagged. Below it, nothing is sent to the model.
Find groupsStatisticsGroups of orders that share one to three facts, each with at least 10 orders and 5 disputed or flagged, ranked by how far their rate sits above your overall rate. The top 30 go to the model as counts.
DraftThe modelPicks up to three groups that make sensible rules, writes each as conditions and an action, and adds a label and an explanation.
CheckStatisticsEvery fact, operator and value must be in your catalog and the values you've seen. The evidence is counted again on your orders, and the draft is backtested against your live rules. A draft that fails any check is dropped.

The model's explanation is shown under a fixed line: "Written by a model from these numbers. The numbers and the backtest are the source of truth." An explanation that names a number the evidence doesn't hold, or any address, link or id, is replaced by a sentence built from the evidence (explanation_source: "template").

A draft is marked limited_data until your account has 500 orders over the last 30 days. Treat a draft with limited data as a lead to check, and lean on its backtest.

1. Report what happened to orders

Drafts learn from outcomes. Some reach Provenance on their own; report the rest on the assessment or the store order.

LabelWhere it comes fromCounts as
chargebackA reported outcome, a chargeback matched to the order, or an evidence pack made for itdisputed
fraudA reported outcome, or a network fraud report you filed on the order's token or agent within 30 daysdisputed
refund_abuseA reported outcome, or refunds on your connected Stripe account or Shopify shop that repeat for the same shopper or agent (three in 90 days)flagged
customer_deniedThe customer denied the cart approvalflagged
store_rejectedYour store rejected the order in review, or staff cancelled a held store orderflagged
legitimateA reported outcome. It clears the flagged labels, never a chargeback or fraudclean

Report any label whose source includes a reported outcome, with an optional note of up to 280 characters. The latest report on an order wins and every report is kept. Reporting is free. Here an order is assessed and then reported as a chargeback:

export ASSESSMENT_ID=$(curl -s -X POST $PROVENANCE_API/v1/authorize/checkout_assessments \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cart":{"order_id":"ord_8813","total":42000,"currency":"USD","merchant_id":"harborbean","origin":"https://harborbean.example","items":[{"sku":"grinder-pro","name":"Burr grinder","quantity":1,"unit_amount":42000}]}}' | jq -r .id)
curl -s -X POST $PROVENANCE_API/v1/authorize/checkout_assessments/$ASSESSMENT_ID/outcome \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"outcome":"chargeback","note":"Card holder disputed the charge"}'
{
  "object": "order_outcome",
  "id": "oot_01M81B2Q7ZC4D8F2H6K0N4R8T2",
  "assessment_id": "cas_01M81B2Q6XW3B7E1G5J9M3Q7S1",
  "store_order_id": null,
  "outcome": "chargeback",
  "kind": "disputed",
  "source": "api",
  "note": "Card holder disputed the charge",
  "reported_at": "2026-11-22T10:02:11.204Z"
}

For a store order, send the same body to POST /v1/authorize/store_orders/{id}/outcome. To report one outcome on up to 100 orders, send { "outcome": "fraud", "ids": [...] } to POST /v1/authorize/order_outcome_batches; it answers once per ID. Another account's order answers 404.

How an order ended

You rarely need to report anything. Each checkout assessment and store order carries ending: how the order ended, worked out from what Provenance heard, with where it came from.

{ "ending": { "outcome": "legitimate", "source": "quiet_period", "at": "2026-11-20T15:04:11.000Z" } }
sourceWhat it means
chargebackA dispute on your connected payment account matched the order
network_reportA fraud report you filed on the order's token or its agent
refundA refund on your connected Stripe account or Shopify shop: refunded, or refund_abuse when refunds repeat for the same shopper or agent
approval_deniedThe shopper declined
staff_cancelYour review rejected it, or staff cancelled a held order
quiet_periodThe order went ahead, your payment connection was listening, and 14 days passed with no dispute or refund: legitimate
reportedAn outcome you reported

ending is null while nothing is known: an order under 14 days old, or a store with no payment connection. The worst wins, so a later chargeback replaces a quiet legitimate, and a report never clears a chargeback or fraud. It is a reading only: it changes nothing about the order, the guarantee or a chargeback response.

In the console, an order's detail shows How it ended with Change for a correction, and the Orders list has Set how it ended for the rows you tick.

2. Get drafts

The nightly job drafts for every account with the assist on. To draft now, refresh; it runs once a day, and each draft shown counts toward your monthly limit.

These calls need the assist on

The sandbox has no model provider, so the requests below answer 503 ai_assist_unconfigured there. The responses shown come from a test provider.
curl -s -X POST $PROVENANCE_API/v1/authorize/policies/rule_suggestions/refresh \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{
  "object": "rule_suggestion_refresh",
  "domain": "checkout",
  "result": "drafted",
  "created": 1,
  "open": [
    {
      "object": "authorize_rule_suggestion",
      "id": "prs_01M81AY7FHVYNM5DWABPYQWC9W",
      "domain": "checkout",
      "status": "open",
      "label": "First-time agent orders",
      "rule": {
        "id": "draft-c52be145f4",
        "label": "First-time agent orders",
        "when": [
          { "fact": "store.agent_order", "op": "eq", "value": true },
          { "fact": "store.customer_order_count", "op": "eq", "value": 0 }
        ],
        "require": { "approval": true }
      },
      "action": "ask",
      "description": "If all of: Placed by an AI agent is true; and Customer's past orders is 0, then challenge the shopper",
      "explanation": "12 of 24 orders in this group were flagged or disputed, against 6% of all orders.",
      "explanation_source": "model",
      "explanation_label": "Written by a model from these numbers. The numbers and the backtest are the source of truth.",
      "evidence": {
        "orders": 24,
        "flagged": 12,
        "disputed": 12,
        "rate": 0.5,
        "baseline_rate": 0.0577,
        "total_orders": 260,
        "total_flagged": 15,
        "window_from": "2026-08-24T09:56:00.600Z",
        "window_to": "2026-11-22T09:56:00.600Z",
        "by_label": { "fraud": 12 },
        "flagged_caught": 12
      },
      "backtest": {
        "object": "policy_backtest",
        "days": 30,
        "requests": 260,
        "totals": { "allowed": 236, "challenged": 24, "rejected": 0 },
        "rules": [
          { "rule_id": "draft-c52be145f4", "label": "First-time agent orders", "outcome": "ask", "matched": 24, "decided": 24, "per_week": 5.6, "summary": "Last 30 days: would have challenged 24 times, about 6 a week" }
        ]
      },
      "limited_data": true,
      "policy_version": null,
      "shadow_version": null,
      "published_version": null,
      "dismissed_until": null,
      "created_at": "2026-11-22T09:56:00.600Z",
      "updated_at": "2026-11-22T09:56:00.600Z"
    }
  ]
}

result says what the run did:

resultMeaning
draftedAt least one new draft passed every check (created counts them).
no_draftThe run found nothing that passed, or the model proposed nothing.
below_floorFewer than 200 orders, under 2 weeks of orders, or fewer than 5 disputed or flagged. Nothing was sent.
cap_reachedYour monthly draft limit is used. Drafts resume on the first of next month.
budget_reachedThe deployment's model budget for the day is used. Try again tomorrow.
errorThe model call failed. No draft is shown, and nothing partial is kept.

open lists the open drafts, at most three per policy. List every suggestion with GET /v1/authorize/policies/rule_suggestions (open, shadowed and the last 90 days; filter with ?status=), or read one with GET /v1/authorize/policies/rule_suggestions/{id}.

Suggestions runs: rules, signals and scorecards

A Suggestions run goes further than the drafts above. It reads your live rule set, and the writing model looks for patterns with read-only SQL over your own order decisions (at most 20 queries a run). It sees grouped counts and sums, never an order or a personal column. It drafts up to five candidates: a new rule, signal or scorecard, or a change to one you have. A suggestion never approves orders.

Each candidate is put into your rule set and checked as a save would be. Then it is tested with a read-only query over the last 90 days of orders, and the query's text is kept in test.sql for you to read. A candidate is kept only when it adds at least 5 true positive declines and no more false positive declines than true ones.

A kept one also carries replay: your live rules and the draft replayed over the last 30 days, with the four labelled results and their value. Suggestions keep counts only, never order ids.

CallWhat it does
GET /v1/authorize/policies/rule_suggestions/settingsThe pace, when the next run is due, and the "Run now" left this month.
PATCH /v1/authorize/policies/rule_suggestions/settingsSet the pace: daily, weekly (the default), biweekly, monthly or off.
POST /v1/authorize/policies/rule_suggestions/runsRun now. Four a month; after that, 429 until next month, and the scheduled runs go on.
GET /v1/authorize/policies/rule_suggestions/runsThe last runs: result, reason, queries, what was kept and dropped.

We pay for runs, scheduled or not, so they don't count toward your monthly drafts. A run needs at least 200 orders across 14 days (below_floor otherwise). If the model or the query layer can't be reached, the run ends unavailable with the reason and stores nothing. Findings you send from an investigation go through the same test.

3. Read a draft

FieldWhat it says
rule, description, actionThe rule as it would be written into your policy, the same rule in words, and its action.
evidenceCounted on your orders over the last 90 days: how many the rule matches (orders), how many were disputed or flagged, their rate against your overall rate (baseline_rate), and the counts per label.
backtestYour live rules plus this one, replayed over the last 30 days: what it would have challenged, rejected or allowed.
explanation, explanation_sourceWhy the rule may help, from the model (model) or from the evidence (template).
limited_dataTrue until your account has 500 orders over the last 30 days.
warningPresent on a draft that rejects or blocks (below).

A draft may propose any action, rejecting included. A rejected customer can't show you what they would have done next, so shadow mode can't tell you how many good orders a reject rule would lose. A draft that rejects carries warning saying so; read its evidence before you shadow it.

4. Try it in shadow mode

Shadowing creates a draft version of your policy (your live rules plus this one) and runs it in shadow beside the live version. Live decisions don't change.

curl -s -X POST $PROVENANCE_API/v1/authorize/policies/rule_suggestions/prs_01M81AY7FHVYNM5DWABPYQWC9W/shadow \
  -H "Authorization: Bearer $PROVENANCE_KEY"
{
  "object": "authorize_rule_suggestion",
  "id": "prs_01M81AY7FHVYNM5DWABPYQWC9W",
  "status": "shadowed",
  "policy_version": null,
  "shadow_version": 1,
  "published_version": null
}

To change the draft first, open it in the console's rule editor from its suggestion card under Rules, edit it, and shadow the edited version. Read how often the shadow version disagreed with the live one in the shadow report (GET /v1/authorize/policies/shadow_report).

5. Publish it

Going live is the same publish as for any version: POST /v1/authorize/policies/versions/{version}/publish with the suggestion's shadow_version. The publish is recorded and sends authorize.policy.published, and the suggestion moves to published.

If the draft isn't useful, dismiss it with POST /v1/authorize/policies/rule_suggestions/{id}/dismiss. It is hidden for 90 days, and the same rule isn't suggested again in that time. An open draft older than 30 days, or one computed against a version that has since been replaced, is checked again by the next run and expires if it fails the checks.

When a draft is created, authorize.rule_suggestion.created is sent to your webhook endpoints with the rule, the evidence counts and the backtest totals. Dismissing or shadowing sends nothing.

Errors you might see

SymptomCauseFix
503 ai_assist_unconfiguredThis deployment has no model providerNothing to fix on your side; reported outcomes still work.
403 ai_assist_offThe checkout assist is off for your accountAn owner or admin turns it on in Account → AI assists.
402 plan_requiredRule drafts are on the Pro plan and above, and your Free trial has endedChoose a plan in Settings → Plan & usage.
429 rate_limit_exceededA refresh already ran today, or "Run now" was used four times this monthWait for Retry-After; the scheduled runs still come.
404 resource_missingNo such suggestion, assessment or store order on your accountCheck the id.

See also