Runs

Eksekusi workflow atas dokumen input. Async (disarankan) atau sync.

Create Run (Async)

Direkomendasikan: JSON body dengan input_documents berisi document ID yang sudah di-upload lewat alur presigned (POST /v1/documentsPUT/complete). Tidak ada batas ukuran selain batas presigned upload itu sendiri.

curl -X POST https://api.platform.kakak.ai/v1/workflows/wf_7Gk2Qp/runs \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"mode":"async","input_documents":["doc_Z4n8Wd"],"metadata":{"key":"value"}}'

Response 202 Accepted dengan run_* ID. Status awal: queued.

Legacy (deprecation window): multipart files[] untuk upload inline masih diterima, tapi dibatasi 4MB total per request (bukan 50MB) — Vercel Function membatasi ukuran body request ke ~4.5MB terlepas dari content-type, jadi file yang lebih besar tidak akan pernah sampai ke server. Untuk file >4MB, gunakan alur presigned di atas.

curl -X POST https://api.platform.kakak.ai/v1/workflows/wf_7Gk2Qp/runs \
  -H "Authorization: Bearer $KEY" \
  -F "mode=async" \
  -F "files[]=@small-doc.pdf" \
  -F 'metadata={"key":"value"}'

Sync Mode (v1)

"mode":"sync" — evaluasi dijalankan inline. Response 200 OK dengan output langsung. Bounded oleh function timeout.

curl -X POST https://api.platform.kakak.ai/v1/workflows/wf_7Gk2Qp/runs \
  -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"sync","input_documents":["doc_Z4n8Wd"]}'

State Machine

queuedrunningsucceededfailedcanceledrefunded

queued → running → succeeded (normal). Failed runs: full refund. Canceled queued runs: full refund.

Endpoints

MethodPathScope
POST/v1/workflows/:id/runsruns:write
GET/v1/runsruns:read
GET/v1/runs/:idruns:read
POST/v1/runs/:id/cancelruns:write
GET/v1/runs/:id/outputruns:read

Idempotency

Gunakan Idempotency-Key header (UUID). Same key + same body → replay response. Same key + different body → 409 conflict. Keys retained 24h.