Update a legal document
PATCH /v1/legal-documents/{id} · permission legal-documents:write
Changes only requires_reacceptance and, while the document is not yet in effect, effective_at (JSON Merge Patch, RFC 7396). Other fields are not in the schema (400 unknown_field) and neither field can be null. A patch that changes nothing does not write and returns the document unchanged. Documents have no version, so If-Match is not used.
Request
Path parameters:
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | yes | Document ID (ldoc_…). |
JSON merge patch (application/merge-patch+json) body (unknown fields are rejected with 400 unknown_field):
| Field | Type | Required | Description |
|---|---|---|---|
requires_reacceptance |
boolean | no | New value; cannot be null. |
effective_at |
string (date-time) | no | Only while the document is not yet in effect; cannot be in the past. |
Response
200 OK with the document.
{
"id": "ldoc_01j9xk3m7q8r2s4t6v8w0y2z4a",
"application_id": null,
"kind": "terms",
"version": "2026-10",
"locale": "en",
"url": "https://example.com/legal/terms-2026-10",
"content_sha256": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08",
"effective_at": "2026-11-01T00:00:00Z",
"requires_reacceptance": true,
"created_at": "2026-10-05T09:30:00.123456Z",
"updated_at": "2026-10-05T09:30:00.123456Z"
}
Errors
| HTTP | code | When |
|---|---|---|
| 400 | unknown_field |
The patch has a field other than requires_reacceptance and effective_at, or is not a JSON object (malformed_request). |
| 404 | not_found |
The document does not exist or belongs to another environment. |
| 415 | unsupported_media_type |
The content type is not application/merge-patch+json. |
| 422 | validation_failed |
A field is null (invalid), effective_at is malformed or in the past, or the document is already in effect (immutable). |
| 401 | unauthenticated |
The credential is missing, invalid or revoked. |
| 403 | insufficient_permissions |
The credential lacks the required permission. |
| 429 | rate_limited |
The rate limit was exceeded; retry after the Retry-After period. |
| 503 | service_unavailable |
A dependency is temporarily unavailable; retry after the Retry-After period. |
Example
curl -X PATCH https://api.eu.keenauth.com/v1/legal-documents/ldoc_01j9xk3m7q8r2s4t6v8w0y2z4a \
-H "Authorization: Bearer $KEENAUTH_SECRET_KEY" \
-H "Content-Type: application/merge-patch+json" \
-d '{"requires_reacceptance":true}'