API reference
Complete an upload
POST /api/pub/v1/files/uploads/{uploadId}/complete, finish a presigned upload and get the file.
POST
https://api.dhanu.ai/api/pub/v1/files/uploads/{uploadId}/completeFinishes 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
| Field | Type | Required | Notes |
|---|---|---|---|
parts | array | Yes |
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
| Code | Status | Meaning |
|---|---|---|
invalid_api_key | 401 | The bearer key is missing or unknown. |
api_key_revoked | 401 | The key was revoked. |
api_key_expired | 401 | The key passed its expiry date. |
api_key_ip_not_allowed | 403 | The caller's IP is outside the key's allowlist. |
developer_access_revoked | 403 | The key's creator lost developer access in the workspace. |
api_key_project_scope | 403 | The key covers no active projects, or projectId is outside its scope. |
invalid_request_body | 422 | The body did not match the schema; error.issues names each field. |
not_found | 404 | No such resource in the key's workspace. |