# Run inspections and escrow

Use Attest for field inspections, marketplace escrow, proof of work and proof of presence by tagging each capture with a case type and requiring signals per vertical in policy.

Use Attest beyond insurance by tagging each capture with a `case_type`. The same capture, attest and verify flow then answers in your vertical's words, and your risk policy can require different signals per vertical.

| `case_type` | Use it for |
| --- | --- |
| `insurance_claim` | Insurance claims (the default when you leave it out) |
| `inspection` | Field and property inspections |
| `escrow` | Item photos in a marketplace sale |
| `proof_of_work` | Proof a job was done |
| `presence` | Proof someone was at a place |
| `custom` | Your own vertical (Enterprise) |

**Before you begin:** export the full-access sandbox key.

```bash
export PROVENANCE_API=https://sandbox-api.provenanceauth.com
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
```

## 1. Tag each capture

Send `case_type` with the signed bundle the capture SDK produced to [`POST /v1/attest/attestations`](https://provenanceauth.com/docs/api/claims.md#post-v1-attest-attestations). This uses a bundle from your own capture app:

**curl**

```bash norun
curl $PROVENANCE_API/v1/attest/attestations \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d "{ \"bundle\": $(cat bundle.json), \"case_type\": \"inspection\" }"
```

**Node**

```ts
import { readFileSync } from "node:fs";
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const result = await prov.attest.attestations.create({ bundle: JSON.parse(readFileSync("bundle.json", "utf8")), caseType: "inspection" });
```

**Python**

```python
import json, os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
result = prov.attest.attestations.create(bundle=json.load(open("bundle.json")), case_type="inspection")
```

```json
{
  "id": "att_3B1WY2X38T9XDSRZHA9NQRP30Y",
  "object": "attestation",
  "risk_score": 0,
  "status": "verified"
}
```

The `claim_id` field holds your case ID in every vertical.

## 2. Read results in your vertical's words

Explanations use the vertical's noun. The sandbox seeds an inspection, `VER-SANDBOX-INSPECTION`:

**curl**

```bash
curl $PROVENANCE_API/v1/attest/claims/VER-SANDBOX-INSPECTION/explanation \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const explanation = await prov.attest.claims.explanation("VER-SANDBOX-INSPECTION");
```

**Python**

```python
explanation = prov.attest.claims.explanation("VER-SANDBOX-INSPECTION")
```

```json
{
  "object": "claim_explanation",
  "claim_id": "VER-SANDBOX-INSPECTION",
  "template_version": "2026-07-05.1",
  "locale": "en",
  "overall_status": "verified",
  "summary": "All provenance checks passed for this inspection — no issues were found.",
  "factors": [],
  "disposition": null
}
```

## 3. Require signals per vertical

`case_type` is a fact in your account's risk policy, so a vertical's rules are configuration. This rule says inspections must carry a biometric; an inspection without one then gets the advisory factor `carrier_policy_biometric_missing`. Try it first against sample facts with [`POST /v1/attest/risk_policies/simulate`](https://provenanceauth.com/docs/api/risk-policies.md#post-v1-attest-risk-policies-simulate). Simulate reads `case_type` the same way attest does: a missing or unrecognized value counts as `insurance_claim`.

The risk policy routes are Attest routes, so the key needs the `attest` scope, which also lets it save the policy. Make an Attest key on the account with its All products key (a key limited to some products can't make keys), or use an [All products key](https://provenanceauth.com/docs/get-started/authentication.md#create-a-key-for-your-products) throughout:

**curl**

```bash
curl -s -X POST "$PROVENANCE_API/v1/account/keys" \
  -H "Authorization: Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Risk policy", "products": ["attest"] }' | tee risk-key.json
export RISK_KEY=$(jq -r .api_key risk-key.json)
```

**Node**

```ts
const res = await fetch(`${process.env.PROVENANCE_API}/v1/account/keys`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5", "Content-Type": "application/json" },
  body: JSON.stringify({ name: "Risk policy", products: ["attest"] }),
});
process.env.RISK_KEY = (await res.json()).api_key;
```

**Python**

```python
import os
import httpx

res = httpx.post(
    f"{os.environ['PROVENANCE_API']}/v1/account/keys",
    headers={"Authorization": "Bearer prv_test_all_A1lP7vQ3bW9mK2sYd6cFjLh8gAe4tR5"},
    json={"name": "Risk policy", "products": ["attest"]},
)
os.environ["RISK_KEY"] = res.json()["api_key"]
```

**curl**

```bash
curl "$PROVENANCE_API/v1/attest/risk_policies/simulate" \
  -H "Authorization: Bearer $RISK_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "document": { "rules": [{ "id": "inspections-need-biometric", "when": [{ "fact": "case_type", "op": "eq", "value": "inspection" }], "require": { "signal": "biometric" } }] },
    "facts": { "case_type": "inspection", "gps_present": true, "biometric_present": false, "attested": true }
  }'
```

**Node**

```ts
const account = new Provenance({ apiKey: process.env.RISK_KEY!, baseUrl: process.env.PROVENANCE_API });
const sim = await account.policy.simulateRisk({
  document: { rules: [{ id: "inspections-need-biometric", when: [{ fact: "case_type", op: "eq", value: "inspection" }], require: { signal: "biometric" } }] },
  facts: { case_type: "inspection", gps_present: true, biometric_present: false, attested: true },
});
```

**Python**

```python
account = Provenance(os.environ["RISK_KEY"], base_url=os.environ["PROVENANCE_API"])
sim = account.policy.simulate_risk(
    document={"rules": [{"id": "inspections-need-biometric", "when": [{"fact": "case_type", "op": "eq", "value": "inspection"}], "require": {"signal": "biometric"}}]},
    facts={"case_type": "inspection", "gps_present": True, "biometric_present": False, "attested": True},
)
```

The response, trimmed:

```json
{
  "object": "policy_simulation",
  "domain": "claims_risk",
  "factors": [{ "factor": "carrier_policy_biometric_missing" }]
}
```

The same facts with `"case_type": "insurance_claim"` return no carrier factor. When the result is what you expect, save the rule with [`PUT /v1/attest/risk_policies`](https://provenanceauth.com/docs/api/risk-policies.md#put-v1-attest-risk-policies):

**curl**

```bash
curl -X PUT "$PROVENANCE_API/v1/attest/risk_policies" \
  -H "Authorization: Bearer $RISK_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "note": "inspections need a biometric",
    "document": { "rules": [{ "id": "inspections-need-biometric", "when": [{ "fact": "case_type", "op": "eq", "value": "inspection" }], "require": { "signal": "biometric" } }] }
  }'
```

**Node**

```ts
await account.policy.set(
  { rules: [{ id: "inspections-need-biometric", when: [{ fact: "case_type", op: "eq", value: "inspection" }], require: { signal: "biometric" } }] },
  { domain: "claims_risk", note: "inspections need a biometric" },
);
```

**Python**

```python
account.policy.set(
    {"rules": [{"id": "inspections-need-biometric", "when": [{"fact": "case_type", "op": "eq", "value": "inspection"}], "require": {"signal": "biometric"}}]},
    domain="claims_risk",
    note="inspections need a biometric",
)
```

```json
{
  "object": "policy_version",
  "domain": "claims_risk",
  "version": 1,
  "active": true,
  "note": "inspections need a biometric"
}
```

The rule applies to attestations from keys on that account. To go back to the default, send `DELETE /v1/attest/risk_policies`; see [policies](https://provenanceauth.com/docs/concepts/policies.md#domains).

**curl**

```bash
curl -s -X DELETE "$PROVENANCE_API/v1/attest/risk_policies" \
  -H "Authorization: Bearer $RISK_KEY"
```

**Node**

```ts
await account.policy.reset({ domain: "claims_risk" });
```

**Python**

```python
account.policy.reset(domain="claims_risk")
```

```json
{ "object": "policy", "domain": "claims_risk", "is_default": true }
```

## Field inspections

Prove each inspection photo or video was captured on site, on a known device, at the stated time. The inspector captures with the [capture SDK](https://provenanceauth.com/docs/attest/guides/native-sdk.md), and your backend attests each signed bundle with `case_type: "inspection"` and the inspection's ID as `claim_id`. Then read the inspection's provenance; the sandbox seeds `VER-SANDBOX-INSPECTION`:

**curl**

```bash
curl $PROVENANCE_API/v1/attest/claims/VER-SANDBOX-INSPECTION/provenance \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const inspection = await prov.attest.claims.getProvenance("VER-SANDBOX-INSPECTION");
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
inspection = prov.attest.claims.get_provenance("VER-SANDBOX-INSPECTION")
```

The response, trimmed to each asset's verdict:

```json
{
  "id": "VER-SANDBOX-INSPECTION",
  "object": "claim",
  "assets": [
    { "id": "att_00000000000000000000000000000020", "object": "verification_result", "status": "verified", "risk_score": 0, "risk_factors": [] },
    { "id": "att_00000000000000000000000000000021", "object": "verification_result", "status": "verified", "risk_score": 0, "risk_factors": [] }
  ],
  "overall_status": "verified",
  "overall_risk_score": 0
}
```

Each asset also carries its device, certificate check, location and chain of custody.

To make every inspection carry GPS, add a rule keyed on `case_type` as in step 3. An inspection without GPS then gets an advisory `carrier_policy_gps_missing` factor. With a `loss_location` sent at attest, a capture far from the site adds `geofence_mismatch`. Enroll inspectors' devices in the [device registry](https://provenanceauth.com/docs/attest/concepts/device-registry.md): a capture from an unknown device scores `device_not_enrolled`.

## Marketplace escrow

Release escrowed funds only when the seller's item photos and video verify as unchanged captures from a real device. The seller captures the item with the [capture SDK](https://provenanceauth.com/docs/attest/guides/native-sdk.md), and your backend attests each signed bundle with `case_type: "escrow"` and the listing or order ID as `claim_id`. Before release, read the case's provenance and release funds only when `overall_status` is `verified`. The sandbox's seeded `CLM-SANDBOX-FRAUD` shows what a changed photo looks like:

Read the case's provenance and release funds only when `overall_status` is `verified`. The sandbox's seeded `CLM-SANDBOX-FRAUD` shows what a changed photo looks like:

**curl**

```bash
curl $PROVENANCE_API/v1/attest/claims/CLM-SANDBOX-FRAUD/provenance \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
import { Provenance } from "@provenanceauth/sdk";

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const listing = await prov.attest.claims.getProvenance("CLM-SANDBOX-FRAUD");
const release = listing.overallStatus === "verified";
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
listing = prov.attest.claims.get_provenance("CLM-SANDBOX-FRAUD")
release = listing["overall_status"] == "verified"
```

The response, trimmed to the verdict:

```json
{
  "id": "CLM-SANDBOX-FRAUD",
  "object": "claim",
  "overall_status": "failed",
  "overall_risk_score": 100
}
```

A `failed` status, such as an edited photo, a stripped screenshot or an unknown device, is your signal to hold the funds and ask for a new capture.

To tie the seller to the moment of capture, require a biometric for `case_type: "escrow"` with a rule as in step 3. For listing photos that were never attested, [screening](https://provenanceauth.com/docs/attest/concepts/synthetic-media-screening.md) gives an advisory score; ask for an attested re-capture before funds move. A `partial` status means a soft signal such as missing GPS: decide per your policy, or require the signal.

## Errors you might see

| Symptom | Cause | Fix |
| --- | --- | --- |
| The explanation says "claim" and your vertical's rules don't apply | `case_type` is missing or isn't a listed type, so it counts as `insurance_claim` | Send a listed type, or `custom`. |
| `402` [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required) | `custom` is Enterprise | See [plans and usage](https://provenanceauth.com/docs/account/plans-and-usage.md). |
| `404` [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing) | The case belongs to another carrier key | Use the key the captures were attested with. |

## See also

- [Policies](https://provenanceauth.com/docs/concepts/policies.md)
- [Verification](https://provenanceauth.com/docs/attest/concepts/verification.md)
- [Risk scoring](https://provenanceauth.com/docs/attest/concepts/risk-scoring.md)
