Aller au contenu

Edit a policy: open its edit draft

POST/api/public/v1/policies/{public_id}/edit

Opens the next version of the AIP as its edit draft, on the same row and under the AIP's own public id: each ratified intent policy of the version named by version (default the current one) is copied in confirmed and grounded again from its stored sentence, its stored answers recommended; the AIP's zones and its strictest attachment mode are copied onto the draft. 202 with the grounding job ({public_id, job_id}); the draft is read with GET /aip/drafts/{public_id}. 200 with the draft when the caller already holds the open draft version. The live AIP keeps enforcing until the edit draft is ratified. 409 DRAFT_EXISTS names the holder in details[] (held_by).

Fenêtre de terminal
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/policies/<policy_public_id>/edit' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"version":1}'
Rôle dans l’organisationCe point de terminaison
ownerAutorisé
adminAutorisé
editorAutorisé
viewerNon autorisé

Une clé porte le rôle que son propriétaire détient dans l’organisation. Voir Authentification.

Portée de clé d’API : policies:write

ParamètreTypeDescription
public_idstringObligatoire.
ParamètreTypeDescription
Idempotency-Keystring or nullOptional. Makes this request safe to retry. Depending on the request, the same key with the same request either joins the job the first one queued (409 JOB_ALREADY_EXISTS, the job id in details) or replays the first answer (Idempotent-Replayed: true; 409 IDEMPOTENCY_IN_PROGRESS while it runs). The same key with another request is 422 IDEMPOTENCY_KEY_REUSED.
ChampTypeDescription
versioninteger or null
ChampTypeDescription
dataobjectObligatoire. One draft: its intent policies, revision, zones, mode, preparation, replay and, for an edit draft, the live version it was opened from.
data.ask_behaviour_overridestring — one of pass_and_review, hold_until_validated or nullThe AIP's own Ask behaviour ratify gives it; null follows the Autonomy Zone.
data.ask_mode_overridestring — one of platform, agent, both or nullThe AIP's own Ask delivery ratify gives it; null follows the Autonomy Zone.
data.edit_ofobject or null
data.edit_of.versionintegerObligatoire.
data.from_framework_presetbooleanObligatoire. True when an intent policy of the draft holds a framework citation, edit drafts included.
data.intent_policiesarray of objectObligatoire.
data.intent_policies[].busyobject or nullWhat runs on the intent policy: grounding, cases (its stored cases checked again), fix, or topping_up (cases written for the values an answer added, appended when ready; it blocks nothing).
data.intent_policies[].capabilityobject or null
data.intent_policies[].cardsarray of objectObligatoire.
data.intent_policies[].casesarray of objectObligatoire.
data.intent_policies[].citationobject or nullObligatoire. The framework preset rule this intent policy came from, edited when its sentence differs; null for anything not drawn from a framework preset.
data.intent_policies[].confirmedobject or null
data.intent_policies[].deferredobject or nullThe deferred part's gap class and fallback; null when it has none.
data.intent_policies[].dimensionstring — one of quality, economics, security, safety, complianceObligatoire.
data.intent_policies[].fallbackobject or null
data.intent_policies[].fixobject or null
data.intent_policies[].idstringObligatoire.
data.intent_policies[].job_idobject or null
data.intent_policies[].languagestringObligatoire.
data.intent_policies[].passageobject or null
data.intent_policies[].refusalobject or null
data.intent_policies[].request_ruleobject or null
data.intent_policies[].sentencestringObligatoire. The intent policy. Empty while the drafting job still prepares it (busy is grounding and it holds no grounding yet): a sentence is served only once it is final.
data.intent_policies[].steerobject or null
data.intent_policies[].validateobject or null
data.languagestringObligatoire.
data.modestring — one of disabled, monitor, enforce or null
data.mode_advicestring or nullObligatoire. The Monitor line on a draft newly made from a framework preset; null otherwise and on edit drafts.
data.preparationobjectObligatoire.
data.preparation.errorobject or null
data.preparation.remainingarray of string — one of ground, test, pack, replayObligatoire.
data.preparation.revisioninteger or null
data.preparation.statestring — one of idle, running, ready, failedObligatoire.
data.preparation.steps_doneintegerObligatoire.
data.preparation.steps_totalintegerObligatoire.
data.public_idstringObligatoire.
data.replayobject or null
data.replay.rowsarray of object
data.replay.statestring — one of running, done, engine_unavailable, emptyObligatoire.
data.replay.summaryobject or nullThe replay's figures over all total rows; null while it runs.
data.replay.totalinteger
data.revisionintegerObligatoire.
data.source_kindstringObligatoire.
data.unavailable_zonesarray of object
data.unavailable_zones[].nameobject or null
data.unavailable_zones[].reasonstring — one of deleted, cannot_take_policyObligatoire.
data.unavailable_zones[].sinceobject or null
data.unavailable_zones[].zone_idstringObligatoire.
data.zone_idsarray of stringObligatoire.
{
"data": {
"ask_behaviour_override": "pass_and_review",
"ask_mode_override": "platform",
"edit_of": {
"version": 3
},
"from_framework_preset": false,
"intent_policies": [
{
"busy": "string",
"capability": "string",
"cards": [
{
"answer": {},
"key": "string",
"kind": "dictionary_values",
"question": "string",
"recommended": {}
}
],
"cases": [
{}
],
"citation": {
"edited": false,
"entries": [
{}
],
"items": [
{}
],
"license_url": "https://app.openlatch.ai/",
"preset_key": "string",
"preset_title": "string",
"rule_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"source_commit": "string",
"source_date": "string",
"source_sentence": "string",
"version": 1
},
"confirmed": false,
"deferred": {
"class": "string",
"fallback": "Ask"
},
"dimension": "quality",
"fallback": "Ask",
"fix": {
"attempts_left": 3,
"available": false,
"diff": {},
"fix_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"reason": "Never push to main without a review.",
"requested": false
},
"id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"job_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"language": "string",
"passage": {
"end": 3,
"start": 3
},
"refusal": {
"class": "nothing_observable",
"reason": "Never push to main without a review."
},
"request_rule": {
"lever": "effort_clamp",
"params": {}
},
"sentence": "string",
"steer": "string",
"validate": {
"example": "string",
"fires_on_every_action": false,
"never_fires": false
}
}
],
"language": "string",
"mode": "disabled",
"mode_advice": "string",
"preparation": {
"error": {
"code": "NOT_FOUND",
"message": "Never push to main without a review."
},
"remaining": [
"ground"
],
"revision": 3,
"state": "idle",
"steps_done": 3,
"steps_total": 3
},
"public_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"replay": {
"rows": [
{
"event_id": "evt_01jbwa2k1vfrn9y42xhgxhmzj2",
"occurred_at": "2026-01-15T14:32:05Z",
"platform": "string",
"readable": false,
"recorded_verdict": "string",
"verdict": "string"
}
],
"state": "running",
"summary": {},
"total": 0
},
"revision": 3,
"source_kind": "string",
"unavailable_zones": [
{
"name": "release-bot",
"reason": "deleted",
"since": "2026-01-15T14:32:05Z",
"zone_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
}
],
"zone_ids": [
"3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
]
}
}