# RFC 6902 JSON Patch between two versions

GET /v1/programs/{id}/versions/{n}/diff: RFC 6902 JSON Patch between two versions

```http
GET /v1/programs/{id}/versions/{n}/diff
```

|  |  |
|---|---|
| Operation id | `diffProgramVersion` |
| Key scope | `read`: every key |
| Section | [Programs](https://docs.kaab.ist/reference/api#programs) |

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | min length 1 |
| `n` | path | integer | yes | ≥ 1 |
| `against` | query | integer | yes | ≥ 1 |

## Example request

```bash
curl -X GET "https://api.kaab.ist/v1/programs/{id}/versions/{n}/diff" \
  -H "Authorization: Bearer $KAAB_API_KEY"
```

## Responses

### 200

Patch

| Field | Type | Required | Description |
|---|---|---|---|
| `patch` | object[] | yes |  |
| `patch[].op` | `"add"`, `"remove"`, `"replace"`, `"move"`, `"copy"`, `"test"` | yes |  |
| `patch[].path` | string | yes |  |
| `patch[].from` | string |  |  |
| `patch[].value` | any |  |  |

## Errors

Every error answers with the [error envelope](https://docs.kaab.ist/reference/api/schemas/error-response); its `code` is one of the [error codes](https://docs.kaab.ist/reference/codes#errors).

| Status | When |
|---|---|
| 400 | `request_invalid`: request validation failed |
| 401 | Missing or invalid API key |
| 403 | The key's scope does not cover this operation |
| 404 | Resource not found |
| 429 | Rate limited; see `Retry-After` |
| 500 | `internal`: unexpected server error |
