# Batches

Re-verifying and screening past claims in one job.

Related guide: [Review claim media](https://provenanceauth.com/docs/attest/guides/review-claims.md)

## Endpoints

- `POST /v1/attest/batches`: [Create a batch](#post-v1-attest-batches)
- `GET /v1/attest/batches/{id}`: [Retrieve a batch](#get-v1-attest-batches-id)
- `GET /v1/attest/batches/{id}/report`: [Get a batch report](#get-v1-attest-batches-id-report)
- `POST /v1/attest/batches/{id}/cancel`: [Cancel a batch](#post-v1-attest-batches-id-cancel)

## The batch object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | yes | Unique identifier for the object. |
| `object` | enum | yes | The type of object. One of `batch`. |
| `status` | string | yes | The object's current status. |
| `progress` | object | yes | Items processed and remaining. |
| `progress.total` | integer | yes | The total. |
| `progress.processed` | integer | yes | How many have been processed. |
| `progress.failed` | integer | yes | How many failed. |
| `created_at` | string | yes | When it was created. |
| `updated_at` | string | yes | When it last changed. |
| `expires_at` | string | yes | When it expires. |

### Example

```json
{
  "id": "bat_01M6VQBD94VR1P6E0MSKMV0FG8",
  "object": "batch",
  "status": "pending",
  "progress": {
    "total": 2,
    "processed": 0,
    "failed": 0
  },
  "created_at": "2026-11-07T19:21:47.044Z",
  "updated_at": "2026-11-07T19:21:47.044Z",
  "expires_at": "2026-11-10T19:21:47.044Z"
}
```

## Create a batch

`POST /v1/attest/batches`

*Available on Enterprise.*

Starts a job that re-verifies past attestations and screens unattested media in one go. Poll the job, then read a report with every verdict and the fraud clusters across the batch.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `items` | body | array of objects | yes | The items. |
| `items.type` | body | enum | no | The type. One of `verify`, `screen`. |
| `items.attestation_id` | body | string | no | The attestation's ID. |
| `items.ref` | body | string | no | A reference to unattested media to screen. |

### Returns

The batch, now pending. See [the batch object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`plan_required`](https://provenanceauth.com/docs/platform/errors.md#plan_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
curl -X POST "$PROVENANCE_API/v1/attest/batches" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/attest/batches", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
    "items": [
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000001"
        },
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000003"
        }
    ]
}).json()
```

### Response 202

```json
{
  "id": "bat_01M6VQBD94VR1P6E0MSKMV0FG8",
  "object": "batch",
  "status": "pending",
  "progress": {
    "total": 2,
    "processed": 0,
    "failed": 0
  },
  "created_at": "2026-11-07T19:21:47.044Z",
  "updated_at": "2026-11-07T19:21:47.044Z",
  "expires_at": "2026-11-10T19:21:47.044Z"
}
```

## Retrieve a batch

`GET /v1/attest/batches/{id}`

Returns a batch job's status and progress.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The batch and its progress. See [the batch object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
curl -s -X POST "$PROVENANCE_API/v1/attest/batches" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }' > step.json
export BATCH_ID=$(jq -r '.id' step.json)
sleep 4
curl "$PROVENANCE_API/v1/attest/batches/$BATCH_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }),
})).json();
const batchId = step1.id;
await new Promise((ok) => setTimeout(ok, 4000));
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches/${batchId}`, {
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
})).json();
```

**Python**

```python
import os
import time
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/attest/batches", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
    "items": [
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000001"
        },
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000003"
        }
    ]
}).json()
batch_id = step1["id"]
time.sleep(4)
data = httpx.get(f"{api}/v1/attest/batches/{batch_id}", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}).json()
```

### Response 200

```json
{
  "id": "bat_01M6VQBD94EN1NGB4XSRX8ZR4Q",
  "object": "batch",
  "status": "completed",
  "progress": {
    "total": 2,
    "processed": 2,
    "failed": 0
  },
  "created_at": "2026-11-07T19:21:47.044Z",
  "updated_at": "2026-11-07T19:21:49.026Z",
  "expires_at": "2026-11-10T19:21:47.044Z"
}
```

## Get a batch report

`GET /v1/attest/batches/{id}/report`

Returns a finished batch's report: each item's verdict and factors, fraud clusters across the batch, summary counts and a signed manifest.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

Each item's result and the signed report.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
curl -s -X POST "$PROVENANCE_API/v1/attest/batches" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }' > step.json
export BATCH_ID=$(jq -r '.id' step.json)
sleep 4
curl "$PROVENANCE_API/v1/attest/batches/$BATCH_ID/report" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      },
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000003"
      }
    ]
  }),
})).json();
const batchId = step1.id;
await new Promise((ok) => setTimeout(ok, 4000));
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches/${batchId}/report`, {
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
})).json();
```

**Python**

```python
import os
import time
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/attest/batches", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
    "items": [
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000001"
        },
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000003"
        }
    ]
}).json()
batch_id = step1["id"]
time.sleep(4)
data = httpx.get(f"{api}/v1/attest/batches/{batch_id}/report", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}).json()
```

### Response 200

```json
{
  "id": "bat_01M6VQBH6BWEP4YY2BQPSZY53T",
  "object": "batch_report",
  "batch_id": "bat_01M6VQBH6BWEP4YY2BQPSZY53T",
  "status": "completed",
  "results": [
    {
      "index": 0,
      "type": "verify",
      "attestation_id": "att_00000000000000000000000000000001",
      "status": "verified",
      "risk_score": 0,
      "risk_factors": [],
      "error": null
    },
    {
      "index": 1,
      "type": "verify",
      "attestation_id": "att_00000000000000000000000000000003",
      "status": "failed",
      "risk_score": 100,
      "risk_factors": [
        "signature_invalid",
        "sensor_hash_mismatch",
        "gps_absent",
        "biometric_absent",
        "exif_missing"
      ],
      "error": null
    }
  ],
  "report": {
    "summary": {
      "total": 2,
      "processed": 2,
      "failed": 0,
      "by_status": {
        "verified": 1,
        "failed": 1
      },
      "fraud_clusters": 1
    },
    "clusters": [
      {
        "attestation_ids": [
          "att_00000000000000000000000000000001",
          "att_00000000000000000000000000000003"
        ],
        "link_types": [
          "shared_device"
        ],
        "strength": "strong"
      }
    ],
    "manifest_hash": "26f450ac8da9f8ff34a2fee711200a37160f598b9e0d04239b45ff871681605a",
    "manifest_signature": "eyJhbGciOiJFUzI1NiIsInR5cCI6InByb3ZlbmFuY2UtYmF0Y2grand0Iiwia2lkIjoiZjc2NWE5OWFkMDU0M2Q5OSJ9.eyJ0eXBlIjoiYmF0Y2gtcmVwb3J0IiwiYmF0Y2hfaWQiOiJiYXRfMDFNNlZRQkg2QldFUDRZWTJCUVBTWlk1M1QiLCJjYXJyaWVyX2lkIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMGMwIiwibWFuaWZlc3RfaGFzaCI6IjI2ZjQ1MGFjOGRhOWY4ZmYzNGEyZmVlNzExMjAwYTM3MTYwZjU5OGI5ZTBkMDQyMzliNDVmZjg3MTY4MTYwNWEiLCJzdW1tYXJ5Ijp7InRvdGFsIjoyLCJwcm9jZXNzZWQiOjIsImZhaWxlZCI6MCwiYnlfc3RhdHVzIjp7InZlcmlmaWVkIjoxLCJmYWlsZWQiOjF9LCJmcmF1ZF9jbHVzdGVycyI6MX19.A3OONLmdPr_Rv1WHVFkA5FphD2upDPA-JvrVje15dsJ-SbsDJ6qX37csGkJq7QNd8UDlb242ZXKf8tcpu1Dmjg"
  }
}
```

## Cancel a batch

`POST /v1/attest/batches/{id}/cancel`

Cancels a pending or running batch. Items already done keep their results.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `id` | path | string | yes | The object's ID. |

### Returns

The batch, now `cancelled`. See [the batch object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`insufficient_scope`](https://provenanceauth.com/docs/platform/errors.md#insufficient_scope)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_full_K7mN3xQp9RbT2vWm8sYd4cFjLhXn6gAe
curl -s -X POST "$PROVENANCE_API/v1/attest/batches" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      }
    ]
  }' > step.json
export BATCH_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/attest/batches/$BATCH_ID/cancel" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "items": [
      {
        "type": "verify",
        "attestation_id": "att_00000000000000000000000000000001"
      }
    ]
  }),
})).json();
const batchId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/attest/batches/${batchId}/cancel`, {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.PROVENANCE_KEY}` },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/attest/batches", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}, json={
    "items": [
        {
            "type": "verify",
            "attestation_id": "att_00000000000000000000000000000001"
        }
    ]
}).json()
batch_id = step1["id"]
data = httpx.post(f"{api}/v1/attest/batches/{batch_id}/cancel", headers={"Authorization": f"Bearer {os.environ['PROVENANCE_KEY']}"}).json()
```

### Response 200

```json
{
  "id": "bat_01M6VQBN3R51GXZYQJ4MVREYKY",
  "object": "batch",
  "status": "canceled",
  "progress": {
    "total": 1,
    "processed": 0,
    "failed": 0
  },
  "created_at": "2026-11-07T19:21:55.064Z",
  "updated_at": "2026-11-07T19:21:55.067Z",
  "expires_at": "2026-11-10T19:21:55.064Z"
}
```
