Skip to content

Start a draft from a source or a preset

POST/api/public/v1/aip/drafts beta

From a source: the draft is created and its read_ground job queued; poll job_id. From a built-in preset: the chosen rules arrive grounded with their stored cases, no model is called and no job is queued (job_id is null), AI authoring on or off. From an organization preset (a PRS- key): the chosen sentences are copied into the draft and grounded in the authoring zone by a read_ground job with READ skipped; poll job_id. zone_id is the authoring zone. 409 AI_NOT_ENABLED for a source or organization preset draft when AI authoring is not enabled; 409 PRESET_CHANGED when a chosen rule is no longer in the preset.

Terminal window
curl --fail-with-body -X POST 'https://app.openlatch.ai/api/public/v1/aip/drafts' \
-H "Authorization: Bearer $OPENLATCH_API_KEY" \
-H 'Content-Type: application/json' \
-d '{"preset":{"key":"examples","intents":["fetch-allowlist","block-web-search","block-pastebin","block-sudo","block-force-push","block-rm-rf"]},"zone_id":"<zone_id>"}'
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: aip:write

ParameterTypeDescription
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.
FieldTypeDescription
presetobject or null
preset.intentsarray of stringRequired.
preset.keystringRequired.
source_idstring (uuid) or null
zone_idstring (uuid) or null
FieldTypeDescription
dataobjectRequired. `202 — the draft exists; job_id is its grounding job, null` for a built-in preset draft (it arrives grounded, with its stored cases).
data.job_idstring or null
data.public_idstringRequired.
{
"data": {
"job_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"public_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
}
}