---
path: /v1/reference/audit-diff
title: Diff two audits
summary: GET /api/public/audit/{id}/diff — per-category and per-criterion deltas between runs.
group: Reference
updated: 2026-06-22
---

# Diff two audits

`GET https://agentfit.dev/api/public/audit/{id}/diff`

Compare run `id` against an earlier run of the same site and return per-category and
per-criterion score deltas. When `baseline` is omitted, the previous completed run for the
site is used automatically.

## Request

| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (UUID) | yes | The newer run to compare. |
| `baseline` | query | string (UUID) | no | The older run to compare against. Defaults to the previous completed run. |

### curl

```bash
curl -s 'https://agentfit.dev/api/public/audit/019eefa7-fdb7-77ac-8c56-ad184e44ece6/diff' | jq '.total_delta'
```

### Python

```python
import requests

run_id = "019eefa7-fdb7-77ac-8c56-ad184e44ece6"
resp = requests.get(f"https://agentfit.dev/api/public/audit/{run_id}/diff", timeout=10)
print(resp.json()["total_delta"])
```

### JavaScript

```javascript
const runId = "019eefa7-fdb7-77ac-8c56-ad184e44ece6";
const resp = await fetch(`https://agentfit.dev/api/public/audit/${runId}/diff`);
console.log((await resp.json()).total_delta);
```

## Response

`categories` and `criteria` are arrays of diff entries. Each entry is keyed by `key` (a
category id `A`…`F` or a criterion id like `D3`) and carries `from`, `to`, `delta`, and the
`from_max`/`to_max` bounds; criterion entries also include `from_status`/`to_status`.

```json
{
  "total_delta": 3,
  "categories": [
    { "key": "D", "from": 16, "to": 18, "delta": 2, "from_max": 19, "to_max": 19 }
  ],
  "criteria": [
    { "key": "D3", "from": 1, "to": 3, "delta": 2, "from_max": 3, "to_max": 3, "from_status": "partial", "to_status": "present" }
  ]
}
```

## Errors

| Status | `code` | Meaning |
|---|---|---|
| 404 | `not_found` | The run id does not exist. |
| 404 | _(no code)_ | No earlier run exists to diff against (auto-baseline found nothing). |
| 422 | `not_done` | The target run has not finished yet. |

> Diffing requires durable runs. The legacy `/audit/{id}` in-memory poll path is
> **deprecated** and stores no history; use the durable `/api/public/audit/*` endpoints.
