---
title: "Diff two revisions of a policy."
method: GET
path: "/api/policies/{policyName}/diff"
tags: ["Policy Versions"]
---

# Diff two revisions of a policy.

`GET /api/policies/{policyName}/diff`

Returns an RFC 6902 JSON Patch array describing what changed between the 'from' revision and the 'to' revision. If from and to are omitted, the two most recent retained revisions are compared. Object-level changes (adds, removes, replaces) are reported per field path; array values that differ are reported as a single replace at the array path. Admins may diff another user's policy via owner. Requires the `policies:read` scope.

## Path parameters

- `policyName` string, required

## Query parameters

- `from` integer
- `to` integer
- `owner` string

## Headers

- `Authorization` string, required

## Response `200`

Diff envelope containing the compared revision numbers and an RFC 6902 changes array.

- string

## Other responses

- `400` — The policy name is missing, fewer than two retained revisions exist for a default diff, or only one of from/to was supplied.
- `401` — The Authorization header is absent or the API key is not recognized.
- `404` — The policy or a requested revision does not exist.
- `413` — Content Too Large
- `415` — Unsupported Media Type
- `500` — Internal Server Error
- `503` — Service Unavailable

---

[API](https://skmtc.net/philterd/apis/philter-api.md) · [All operations](https://skmtc.net/philterd/apis/philter-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/philterd/philter-api/versions/67443cd5a65b/schema)
