Skip to content

Complete File Upload

POST /api/videos/uploads/{uploadSessionId}/files/{uploadId}/complete

Finalize one uploaded file. Once every file in the upload group reaches completed, SpatialGen will automatically create the downstream library record and processing job for the full video asset set.

Allowed API Key Roles

adminupload

Route Parameters

  • uploadSessionId: string UUID for the upload group
  • uploadId: string UUID for the file within that group

Request Body

  • parts: array, optional for single_put, required for multipart

Each multipart parts[] item includes:

  • partNumber: positive integer
  • etag: string

Behavior Notes

  • Multipart completion must include every part number from 1 through totalParts.
  • Single-part uploads do not need to send a parts array.
  • Repeating complete on an already completed file is safe and will return the same file state.
  • When the last file in the group completes, SpatialGen creates one library record and queues one processing job automatically.
  • libraryId stays null until the upload group is fully completed. The final successful complete call returns the new library ID.

Response Shape

  • uploadId: string
  • fileRole: string
  • fileName: string
  • totalBytes: number
  • partSizeBytes: number
  • totalParts: number
  • uploadStrategy: "single_put" | "multipart"
  • status: string
  • libraryId: number | null

Example Request

complete-upload.js
fetch('https://spatialgen.com/api/videos/uploads/5ea97a59-95e0-4c8b-a634-b0fa9976f6ff/files/402f0bda-a0fa-4551-ae28-7300ab6678dd/complete', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-SPATIALGEN-APPKEY': apiKey,
},
body: JSON.stringify({
parts: [
{ partNumber: 1, etag: '"etag-part-1"' },
{ partNumber: 2, etag: '"etag-part-2"' },
],
}),
})

Example Response

complete-response.json
{
"uploadId": "402f0bda-a0fa-4551-ae28-7300ab6678dd",
"fileRole": "video_left",
"fileName": "left-eye.mov",
"totalBytes": 1287340032,
"partSizeBytes": 104857600,
"totalParts": 13,
"uploadStrategy": "multipart",
"status": "completed",
"libraryId": 4821
}