Skip to content

Apply an earlier version of a policy

POST/api/public/v1/policies/{public_id}/versions/{version}/apply

Ratifies a new version whose intent policies are copies of version version's: every sentence with its rules, cases, fallback, answers and answered exceptions. The earlier versions and their history stay; the AIP's zones and their modes are kept, and their bundles carry the new version. One audit entry names both versions. 202 with a job already succeeded (GET /aip/jobs/{job_id}), whose result is {version, applied_version, previous_version}. An open edit draft keeps its rows and answers 409 EDIT_DRAFT_STALE at ratify. 409 NOT_RATIFIED also answers a version ratified before the engine swap (details[] reason pre_swap_version). An agent (OAuth) caller must send sentences, the version's ratified sentences: 428 SENTENCES_REQUIRED without them, 409 SENTENCES_MISMATCH unless they match.

Terminal window
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policies/<policy_public_id>/versions/<version>/apply' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"sentences":<sentences>}'
Role in the organizationThis endpoint
ownerAllowed
adminAllowed
editorAllowed
viewerNot allowed

A key carries the role its owner holds in the organization. See Authentication.

API key scope: policies:write

ParameterTypeDescription
public_idstringRequired.
versionintegerRequired.
ParameterTypeDescription
Idempotency-Keystring or nullOptional. Makes the request safe to retry: the same key and the same request, within 24 hours, returns the stored response with Idempotent-Replayed: true and runs once.
FieldTypeDescription
sentencesarray of string or nullThe exact sentences this call puts in force, as shown to the user. Required of an agent (OAuth) caller: 428 SENTENCES_REQUIRED without them, 409 SENTENCES_MISMATCH unless they match the sentences put in force (the same sentences, order ignored, each as many times as it appears, after Unicode NFC and whitespace normalisation).
FieldTypeDescription
dataobjectRequired. `202 for a job-starting operation: poll GET /aip/jobs/{job_id}`.
data.job_idstringRequired.
{
"data": {
"job_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
}
}