Skip to content
dhanu docs
Browse pages

API reference

Complete an upload

POST /api/pub/v1/files/uploads/{uploadId}/complete, finish a presigned upload and get the file.

POSThttps://api.dhanu.ai/api/pub/v1/files/uploads/{uploadId}/complete

Finishes a presigned upload once every part has been PUT. Send each part’s number with the ETag the storage returned for it; the parts are stitched together and the file appears in the drive.

Request

FieldTypeRequiredNotes
partsarrayYes
curl -X POST https://api.dhanu.ai/api/pub/v1/files/uploads/$SESSION_ID/complete \
  -H "Authorization: Bearer $DHANU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "parts": [{ "partNumber": 1, "etag": "\"9b2cf…\"" }] }'
const file = await dhanu.files.completeUpload(session.sessionId, [
  { partNumber: 1, etag: '"9b2cf…"' },
]);
file = dhanu.files.complete_upload(session.session_id, [{"partNumber": 1, "etag": '"9b2cf…"'}])

Response

201 Created

{ "file": { "id": "…", "filename": "recording.mp4", "mimeType": "video/mp4", "sizeBytes": 734003200, "kind": "video", "createdAt": "…" } }

Errors

CodeStatusMeaning
invalid_api_key401The bearer key is missing or unknown.
api_key_revoked401The key was revoked.
api_key_expired401The key passed its expiry date.
api_key_ip_not_allowed403The caller's IP is outside the key's allowlist.
developer_access_revoked403The key's creator lost developer access in the workspace.
api_key_project_scope403The key covers no active projects, or projectId is outside its scope.
invalid_request_body422The body did not match the schema; error.issues names each field.
not_found404No such resource in the key's workspace.