# Verification

Verification checks one photo or video and returns a status, a risk score, the factors behind it, the chain of custody and the device.

Verification is the check Attest runs on one photo or video, that returns a status, a risk score, the factors behind the score, the chain of custody and the device that captured it.

## When to use it

Verify an asset when it arrives, before you act on it, and again whenever you need a current answer, for example after a device is revoked. Verify by `attestation_id` for an asset Attest already holds, or send the image bytes, or a video with its manifest.

## How it works

1. **Find the bundle.** Extract it from the JPEG's XMP, or take the video's sidecar manifest. With none, the result has [`no_manifest`](https://provenanceauth.com/docs/platform/reason-codes.md#no_manifest).
2. **Recompute the hash.** Hash the image bytes into `sensor_hash`, or rebuild the video's chunk chain.
3. **Check the signature and certificate.** Verify the signature against `device_cert`, and the certificate against the root CA.
4. **Check the device.** Is it enrolled, and has it been revoked?
5. **Score.** Add the points for each factor, cap at 100, and derive the status (see [risk scoring](https://provenanceauth.com/docs/attest/concepts/risk-scoring.md)).

1. **Asset**: attestation_id, image or video
2. **Checks**: hash, signature, certificate, device
3. **Result**: status + risk_score

## Key fields

- `status` (string): `verified` (score 0–30), `partial` (31–80, for review) or `failed` (81–100, for investigation).
- `risk_score` (integer): The sum of the factors' points, capped at 100.
- `risk_factors` (object[]): Each factor that applied, with its `points` and a `description`.
- `chain` (object[]): The [chain of custody](https://provenanceauth.com/docs/attest/concepts/chain-of-custody.md): capture, edits and escalations, oldest first.
- `device_info` (object): The device: `enrolled`, `cert_valid` and `cert_expires`.
- `sensor_hash` (string | null): The signed hash: the image's SHA-256, or the video's chain root. Hash a file you hold and compare, to prove it's this asset. `null` without a bundle.
- `liveness_checked` (boolean): Whether live-session timing checks ran (videos captured in a live session).
- `synthetic_media_score` (integer | null): A third-party detector's score, only after [screening](https://provenanceauth.com/docs/attest/concepts/synthetic-media-screening.md). Never part of `risk_score`.

## Verify an asset

**curl**

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

curl $PROVENANCE_API/v1/attest/verifications \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "attestation_id": "att_00000000000000000000000000000005" }'
```

**Node**

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

const prov = new Provenance({ apiKey: process.env.PROVENANCE_KEY!, baseUrl: process.env.PROVENANCE_API });
const result = await prov.attest.verifications.create({ attestationId: "att_00000000000000000000000000000005" });
```

**Python**

```python
import os
from provenanceauth import Provenance

prov = Provenance(os.environ["PROVENANCE_KEY"], base_url=os.environ["PROVENANCE_API"])
result = prov.attest.verifications.create(attestation_id="att_00000000000000000000000000000005")
```

This seeded video had one chunk changed after capture. The response, trimmed:

```json
{
  "id": "att_00000000000000000000000000000005",
  "object": "verification_result",
  "claim_id": "CLM-SANDBOX-VIDEO",
  "status": "partial",
  "risk_score": 50,
  "risk_factors": [
    { "factor": "frame_hash_mismatch", "points": 50, "description": "Recomputed chunk hash chain does not match the manifest (first mismatch at chunk 1)" }
  ],
  "capture_type": "video",
  "liveness_checked": false,
  "synthetic_media_score": null
}
```

## Two separate signals

`risk_score` answers whether Provenance can prove the asset is authentic. `synthetic_media_score` answers whether a third-party detector thinks it looks AI-generated. They are never merged: a proven asset makes the detector's view moot, and the detector only matters for an asset that can't be proven.

## Related

- [Risk scoring](https://provenanceauth.com/docs/attest/concepts/risk-scoring.md)
- [Attestation bundles](https://provenanceauth.com/docs/attest/concepts/attestation-bundles.md)
- [Attest API reference](https://provenanceauth.com/docs/api/claims.md)
