View as Markdown

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 /v1/attest/capture_policies. 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:

requireActionThe shot is
{ "frictionless": true }Approveapproved, unless one of its checks failed
{ "approval": true }Reviewin_review, for you to decide in your own system
{ "deny": true }Rejectrejected. 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

FactTypeMeaning
capture.min_distance_km.<ref>kmThe distance from the fix to the reference, less the fix's accuracy: the distance the evidence supports at least
capture.distance_km.<ref>kmThe distance from the fix to the reference
capture.timezone_matches.<ref>yes/noThe device's UTC offset is the one in use at the reference
capture.network_country_matches.<ref>, capture.network_region_matches.<ref>, capture.network_city_matches.<ref>yes/noThe network's country, region or city is the reference's (the city only with its switch on)
capture.gps_present, capture.gps_source, capture.gps_accuracy_m, capture.gps_mockThe fix, where it came from (device_signed, browser_reported, none), its accuracy in metres, and a mock location Android reported
capture.network_country, capture.network_regionISO codesThe network's country and region
capture.network.vpn_or_proxy, capture.network.hosting_providerlikely or not_detected; a published cloud range
capture.os, capture.os_version, capture.os_attestedThe OS, its version, and whether Android's key attestation proved it
capture.clock_offset_s, capture.exif_consistentThe device clock less ours; the photo's own tags agree with the capture
capture.tier, capture.destinationThe device tier, and where it was opened (web, company_app, provenance_app, app_clip)
capture.screen_or_print, capture.risk_scoreThe screen-or-print check (suspected or clear; absent when not checked), and the shot's risk score out of 100
capture.document_type, capture.document_acceptedOn an ID shot, the document type (passport, driving_license, not_a_document, ...) and whether the request accepts it; absent when the check didn't run

<ref> names a reference by its kind:

<ref>The reference
loss_addresskind: "loss"
person_addresskind: "person"
business_addresskind: "business"
shipping_addresskind: "shipping"
other_address, other_address_2the 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" }:

RowWhenBuilt-in outcomeTakes
passesThe shot's checks passedapproveapprove, review, reject
flaggedA check flagged the shotreviewapprove, 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

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 /v1/attest/capture_requests/{id}/assessment 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

SymptomCauseFix
402 plan_requiredA rule matches any of its conditions (match: "any") below ProSplit it into one rule per condition, or move to Pro.
400 policy_invalid on rules.N.whenA fact that isn't a capture fact, or a named listUse a capture.* fact from the table.
400 policy_invalid on rules.N.requireAnything but frictionless, approval or deny, or more than oneGive each rule one action.
403 insufficient_scopeThe key isn't an Attest keyUse an Attest key.

See also