Attest · Guide
Capture rules
Capture rules decide each photo as it lands. A rule reads the shot's facts (its GPS, network, device, tier and its distance from an address you sent) and says Approve, Review or Reject. The first rule that matches decides. With no rules, each shot's checks decide. Capture rules are a policy: the same rule format, versions and simulate as every product.
A capture rule never asks the person to capture again. The capture page shows the same finished screen whatever the outcome, and the person never sees it.
Availability: every plan, for rules whose conditions each read one fact and all have to hold, as many as you need. A rule that matches any of its conditions, backtests and trial runs are on Pro and above.
Before you begin: read capture requests, and send reference addresses on a request when a rule compares a shot with an address.
1. Write the rules
Rules live at PUT /. In the console, open Rules › Captures.
{
"note": "review photos far from the loss, reject mock locations",
"document": {
"rules": [
{ "id": "mock-location", "label": "Mock location", "when": [{ "fact": "capture.gps_mock", "op": "eq", "value": true }], "require": { "deny": true } },
{
"id": "far-from-loss",
"label": "More than 5 km from the loss address",
"when": [{ "fact": "capture.min_distance_km.loss_address", "op": "gt", "value": 5, "if_unavailable": "match" }],
"require": { "approval": true }
}
]
}
}
Each rule takes one action:
require | Action | The shot is |
|---|---|---|
{ "frictionless": true } | Approve | approved, unless one of its checks failed |
{ "approval": true } | Review | in_, for you to decide in your own system |
{ "deny": true } | Reject | rejected. The capture still completes and the photo is kept |
An Approve rule never clears a failed check: a failed attestation, a suspected virtual camera, a flagged image, a decisive photo check that failed, or the device tier the request asked for not met. Such a shot is in_review with outcome_reason: "capture_rule_approve_held".
A rule below one that always decides first never runs. The write still saves, and says so in warnings (shadowed_by).
2. The facts a rule reads
| Fact | Type | Meaning |
|---|---|---|
capture. | km | The distance from the fix to the reference, less the fix's accuracy: the distance the evidence supports at least |
capture. | km | The distance from the fix to the reference |
capture. | yes/no | The device's UTC offset is the one in use at the reference |
capture., capture., capture. | yes/no | The network's country, region or city is the reference's (the city only with its switch on) |
capture., capture., capture., capture. | The fix, where it came from (device_, browser_, none), its accuracy in metres, and a mock location Android reported | |
capture., capture. | ISO codes | The network's country and region |
capture., capture. | likely or not_; a published cloud range | |
capture., capture., capture. | The OS, its version, and whether Android's key attestation proved it | |
capture., capture. | The device clock less ours; the photo's own tags agree with the capture | |
capture., capture. | The device tier, and where it was opened (web, company_, provenance_, app_) | |
capture., capture. | The screen-or-print check (suspected or clear; absent when not checked), and the shot's risk score out of 100 | |
capture., capture. | On an ID shot, the document type (passport, driving_, not_, ...) and whether the request accepts it; absent when the check didn't run |
<ref> names a reference by its kind:
<ref> | The reference |
|---|---|
loss_ | kind: "loss" |
person_ | kind: "person" |
business_ | kind: "business" |
shipping_ | kind: "shipping" |
other_, other_ | the first and second kind: "other" |
A fact the shot couldn't give is absent, with a reason code such as permission_denied or geocoder_not_configured. A condition on an absent fact doesn't match. Add "if_unavailable": "match" to a condition to match it instead, as the rule above does: a photo with no distance to the loss address goes to Review too.
3. Read the outcome
Each shot's checks on the request carry its outcome, and each item and the completed request carry the worst one (Rejected over In review over Approved). checks, what the checks found, stays beside it.
"items": [
{
"index": 0,
"outcome": "in_review",
"policy": {
"version": 4,
"rule": {
"id": "far-from-loss",
"name": "More than 5 km from the loss address",
"phase": "assess",
"action": "review",
"conditions": [{ "fact": "capture.min_distance_km.loss_address", "op": "gt", "value": 5, "actual": 12 }]
}
}
}
]
policy is the rule that decided, with each condition and the value it compared (actual). Only the deciding rule is listed, and a comparison with an address appears only there. policy is null when no rule matched and the shot's checks decided.
When no rule matches, the fallback rows decide. Set fallback on the document to change either, such as "fallback": { "flagged": "reject" }:
| Row | When | Built-in outcome | Takes |
|---|---|---|---|
passes | The shot's checks passed | approve | approve, review, reject |
flagged | A check flagged the shot | review | approve, review, reject |
A shot the fallback decided names it in its reason, such as capture_fallback_rejected. An Approve still never clears a failed hard check or an unmet device tier.
The same fields are on the attest.capture_request.item_captured and attest.capture_request.completed webhooks. Read Review and Reject from them and decide in your own system.
4. Try rules before they decide
- POST
/runs a draft against one shot's facts, withv1/ attest/ capture_ policies/ simulate unavailablefor facts the shot couldn't give andchecks_failedfor checks it failed. - POST
/replays a draft over the shots of the last 30 days, from the facts each shot recorded.v1/ attest/ capture_ policies/ backtest - A trial run (Pro): publish a draft with
trial_days. Each shot records what the draft would have decided, and GET/lists where it differed. Nothing it decides is enforced.v1/ attest/ capture_ policies/ trial
5. From the SDK
Save a draft, publish it when it's ready, then read each request's assessment: its outcome, the rule that decided and each shot's context.
const draft = await provenance.attest.capturePolicies.createDraft({ rules }, { note: "review photos far from the loss" });
await provenance.attest.capturePolicies.publishVersion(draft.version);
const assessment = await provenance.attest.captureRequests.assessment(request.id);
// assessment.outcome: "approved" | "in_review" | "rejected"; assessment.policy: the deciding rule
draft = provenance.attest.capture_policies.create_draft({"rules": rules}, note="review photos far from the loss")
provenance.attest.capture_policies.publish_version(draft["version"])
assessment = provenance.attest.capture_requests.assessment(request["id"])
GET / answers 404 capture_assessment_not_ready until the first photo lands.
Let your team change them in your admin
<provenance-rules> shows your capture rules to your claims staff inside your own admin tool, with the values you choose as blanks and bounds. Mint it with an Attest key and object_id: "capture"; it previews in counts of photos and publishes like the console. See rules in your admin.
Limitations
- A distance says where the device reported it was when the photo was taken, signed by the device key in your app or reported by a browser. It doesn't prove where a person lives or works.
- An address reference is placed at its postal code or city, not its street, so a distance to it is as close as that. Rules on
capture.min_distance_km.<ref>already subtract the difference. An address the geocoder can't place has no distances (geocode_not_found); send it as coordinates instead. - Rules run as each shot lands, with the rules live at that moment. A change applies to the shots that land after it.
Errors you might see
| Symptom | Cause | Fix |
|---|---|---|
402 plan_ | A rule matches any of its conditions (match: "any") below Pro | Split it into one rule per condition, or move to Pro. |
400 policy_ on rules. | A fact that isn't a capture fact, or a named list | Use a capture. fact from the table. |
400 policy_ on rules. | Anything but frictionless, approval or deny, or more than one | Give each rule one action. |
403 insufficient_ | The key isn't an Attest key | Use an Attest key. |