Ir al contenido

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.

Ventana de terminal
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>"}'
Rol en la organizaciónEste punto de conexión
ownerPermitido
adminPermitido
editorPermitido
viewerNo permitido

Una clave tiene el rol que su propietario ocupa en la organización. Consulte Autenticación.

Ámbito de la clave de API: aip:write

ParámetroTipoDescripción
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.
CampoTipoDescripción
presetobject or null
preset.intentsarray of stringObligatorio.
preset.keystringObligatorio.
source_idstring (uuid) or null
zone_idstring (uuid) or null
CampoTipoDescripción
dataobjectObligatorio. `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_idstringObligatorio.
{
"data": {
"job_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10",
"public_id": "3f6c1a2e-8b4d-4c1f-9a7e-0d5b2c8e4f10"
}
}