Skip to content

Chunked uploads

Upload large files in chunks via a five-step session — init, upload each chunk, then complete (or abort) — for files too big for the single-request presign → confirm flow in Attachments. A session belongs to one task or one project, is owned by the caller who started it (status/complete/abort all 404 for anyone else), and expires 24 hours after init. The workspace's storage-plan limit is checked once, at init, using the file size you declare.

POST

/chunked-upload/init

Starts a new upload session. Exactly one of taskId/projectId targets where the resulting attachment is created; if both are given, taskId wins.

Body parameters

  • taskIdintegeroptionalTarget task — provide this or projectId
  • projectIdintegeroptionalTarget project — provide this or taskId
  • fileNamestringrequiredOriginal file name
  • fileSizeintegerrequiredFile size in bytes
  • fileTypestringrequiredMIME type
  • parentIdintegeroptionalAn existing task-attachment id to version onto (task uploads only)
GET

/chunked-upload/status/{sessionId}

Returns the progress of an upload session.

POST

/chunked-upload/chunk/{sessionId}/{partNumber}

Uploads one chunk's raw bytes as a multipart part. The request body is the chunk itself (application/octet-stream), not JSON — there are no body parameters to set.

POST

/chunked-upload/complete/{sessionId}

Finalizes the session once every chunk has arrived and creates the resulting attachment. Takes no request body.

DELETE

/chunked-upload/abort/{sessionId}

Cancels an in-progress session.

View example
Start an upload session
curl -X POST https://api.klaarin.com/v1/chunked-upload/init \
  -H "Authorization: Bearer kl_live_9f2ac…" \
  -H "Content-Type: application/json" \
  -d '{ "taskId": 318, "fileName": "recording.mp4", "fileSize": 314572800, "fileType": "video/mp4" }'
Response
{
  "sessionId": "clx9z8y7x6w5v4u3t2s1r0",
  "fileName": "recording.mp4",
  "chunkSize": 5242880,
  "totalChunks": 60
}