> This page is for version v1.3 (default).
> For other versions, use one of these documentation indexes:
> - v1.3 (default): https://docs.twelvelabs.io/v1.3/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.twelvelabs.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.twelvelabs.io/_mcp/server.

# Multipart uploads

> Upload local video, audio, and images in chunks for reliable, resumable transfers.

Use multipart uploads for local video and audio files up to 10 GB, and images up to 32 MB. This method divides the file into smaller chunks for reliable uploads, especially when you need parallel chunk uploads or want to resume an interrupted transfer.

Multipart uploads create assets that you can use in different workflows.

# High-level upload methods

The `MultipartUploadWrapper` class provides convenience methods that simplify multipart uploads. Use these methods for most upload scenarios.

For a complete example that demonstrates progress tracking, error handling, and batch uploads, see the [multipart\_uploads.ts](https://github.com/twelvelabs-io/twelvelabs-js/blob/main/examples/multipart_uploads.ts) example in the SDK repository.

## Upload a file

**Description**: Upload a local file using multipart upload with automatic chunking, parallel uploads, progress tracking, and retry logic.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
uploadFile(
    filePath: string,
    options?: UploadFileOptions
): Promise<UploadResult>
```

**`Node.js Simple upload`**

```javascript Node.js Simple upload
import { TwelveLabs } from "twelvelabs-js";

const result = await client.multipartUpload.uploadFile("<YOUR_FILE_PATH>");
console.log(`Asset ID: ${result.assetId}`);
console.log(`Asset URL: ${result.assetUrl}`);
```

**`Upload with progress tracking`**

```javascript Upload with progress tracking
const progressCallback = (progress) => {
    console.log(`Progress: ${progress.percentage.toFixed(1)}% (${progress.completedChunks}/${progress.totalChunks} chunks)`);
};

const result = await client.multipartUpload.uploadFile("<YOUR_FILE_PATH>", {
    filename: "<YOUR_FILE_NAME>",
    progressCallback: progressCallback,
    maxWorkers: 3,
});
console.log(`Upload completed! Asset ID: ${result.assetId}`);
```

### Parameters

| Name       | Type                | Required | Description                           |
| :--------- | :------------------ | :------- | :------------------------------------ |
| `filePath` | `string`            | Yes      | The path to the local file to upload. |
| `options`  | `UploadFileOptions` | No       | Upload configuration options.         |

The `UploadFileOptions` interface has the following properties:

| Name               | Type                                         | Required | Description                                                                               |
| ------------------ | -------------------------------------------- | -------- | ----------------------------------------------------------------------------------------- |
| `filename`         | `string`                                     | No       | The filename of the asset. Defaults to the file basename.                                 |
| `fileType`         | `TwelvelabsApi.CreateAssetUploadRequestType` | No       | The type of asset to upload. Values: `"video"`, `"audio"`, `"image"`. Default: `"video"`. |
| `batchSize`        | `number`                                     | No       | The number of chunks to report in each batch. Default: `10`.                              |
| `maxWorkers`       | `number`                                     | No       | The maximum concurrent upload workers. Default: `5`.                                      |
| `progressCallback` | `(progress: UploadProgress) => void`         | No       | The callback function for progress updates.                                               |
| `maxRetries`       | `number`                                     | No       | The maximum retry attempts for failed chunks. Default: `3`.                               |
| `retryDelay`       | `number`                                     | No       | The delay between retries in seconds. Default: `1.0`. Uses exponential backoff.           |
| `requestOptions`   | `MultipartUpload.RequestOptions`             | No       | Request-specific configuration.                                                           |

### Return value

Returns a `Promise` that resolves to an `UploadResult` object.

The `UploadResult` interface contains the following properties:

| Name       | Type     | Description                                  |
| ---------- | -------- | -------------------------------------------- |
| `assetId`  | `string` | The unique identifier of the uploaded asset. |
| `assetUrl` | `string` | The URL to access the uploaded asset.        |

The `UploadProgress` interface (used in `progressCallback`) contains the following properties:

| Name              | Type     | Description                     |
| ----------------- | -------- | ------------------------------- |
| `totalChunks`     | `number` | The Total number of chunks.     |
| `completedChunks` | `number` | The number of completed chunks. |
| `percentage`      | `number` | The upload percentage (0-100).  |
| `status`          | `string` | The current upload status.      |

## Monitor upload completion

**Description**: Monitor a multipart upload by checking its status at regular intervals.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
waitForUploadCompletion(
    uploadId: string,
    options?: WaitForCompletionOptions
): Promise<UploadStatus>
```

**`Node.js example`**

```javascript Node.js example
import { TwelveLabs } from "twelvelabs-js";

const completedUpload = await client.multipartUpload.waitForUploadCompletion("<YOUR_UPLOAD_ID>", {
    sleepInterval: 10.0,
    maxWaitTime: 3600.0,  // 1 hour timeout
});

console.log(`Status: ${completedUpload.status}`);
console.log(`Completed chunks: ${completedUpload.completedChunks}/${completedUpload.totalChunks}`);
```

### Parameters

| Name       | Type                       | Required | Description                                  |
| :--------- | :------------------------- | :------- | :------------------------------------------- |
| `uploadId` | `string`                   | Yes      | The unique identifier of the upload session. |
| `options`  | `WaitForCompletionOptions` | No       | Wait configuration options.                  |

The `WaitForCompletionOptions` interface has the following properties:

| Name             | Type                             | Required | Description                                                                         |
| ---------------- | -------------------------------- | -------- | ----------------------------------------------------------------------------------- |
| `sleepInterval`  | `number`                         | No       | The wait time between status checks in seconds. Default: `5.0`.                     |
| `maxWaitTime`    | `number`                         | No       | The maximum wait time in seconds before timeout. Default: `undefined` (no timeout). |
| `callback`       | `(status: UploadStatus) => void` | No       | The function called after each status check.                                        |
| `requestOptions` | `MultipartUpload.RequestOptions` | No       | Request-specific configuration.                                                     |

### Return value

Returns a `Promise` that resolves to an `UploadStatus` object.

The `UploadStatus` interface contains the following properties:

| Name              | Type     | Description                                        |
| ----------------- | -------- | -------------------------------------------------- |
| `status`          | `string` | The upload status ("completed" or "in\_progress"). |
| `completedChunks` | `number` | The number of completed chunks.                    |
| `totalChunks`     | `number` | The total number of chunks.                        |

# Low-level API methods

The `MultipartUpload` class provides methods to manage multipart upload sessions. Use these methods when you need fine-grained control over the upload process.

## Workflow

Determine the total size of your file in bytes. You'll need this value when creating the upload session.

**Create an upload session**: Call the [multipartUpload.create\`](/v1.3/sdk-reference/node-js/upload-content/multipart-uploads#create-a-multipart-upload-session) method, providing details about your file, including its size. The response contains, among other information, the unique identifier of the asset, a list of upload URLs, and the size of each chunk in bytes.

**Split your file**: Use the chunk size from the response to divide your file into chunks of the specified size.

**Upload chunks**: Transfer each chunk to its designated presigned URL. You can upload the chunks in parallel for improved performance. Save the ETag from each upload response for progress reporting.

*(Optional)* **Request additional URLs**: Call the [`multipartUpload.getAdditionalPresignedUrls`](/v1.3/sdk-reference/node-js/upload-content/multipart-uploads#request-presigned-urls-for-the-remaining-chunks) method if you need URLs for remaining chunks or if existing URLs expire.

**Report progress**: Submit completed chunks via the [`multipartUpload.getAdditionalPresignedUrls`](/v1.3/sdk-reference/node-js/upload-content/multipart-uploads#request-presigned-urls-for-the-remaining-chunks) method in batches as chunks finish uploading. Use the ETag from each chunk upload as proof of successful transfer.

**Confirm completion**: The upload session is complete when the [`multipartUpload.getStatus`](/v1.3/sdk-reference/node-js/upload-content/multipart-uploads#retrieve-the-status-of-an-upload-session) method returns `status: 'completed'`. This status means the platform received the file, not that the asset is ready. Asset processing is asynchronous. Poll the [`assets.retrieve`](/v1.3/sdk-reference/node-js/manage-assets#retrieve-an-asset) method until the `status` field is `ready` before you use the asset.

**What you do next depends on your use case**:

* **For creating embeddings**: Use the asset ID with the [Embed API v2](/v1.3/sdk-reference/node-js/create-embeddings-v-2).
* **For search and analysis**: [Index an asset](/v1.3/sdk-reference/node-js/index-content#index-an-asset) using the asset ID.

## List incomplete uploads

**Description**: This method returns a list of all incomplete multipart upload sessions in your account.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
listIncompleteUploads(
    request?: TwelvelabsApi.MultipartUploadListIncompleteUploadsRequest,
    requestOptions?: MultipartUpload.RequestOptions
): Promise<core.Page<TwelvelabsApi.IncompleteUploadSummary>>
```

**`Node.js example`**

```javascript Node.js example
import { TwelveLabs } from "twelvelabs-js";

const response = await client.multipartUpload.listIncompleteUploads({
    page: 1,
    pageLimit: 10,
});

console.log("Incomplete Uploads:");
for await (const upload of response) {
    console.log(`  Upload ID: ${upload.uploadId}`);
    console.log(`  Status: ${upload.status}`);
    console.log(`  Total size: ${upload.totalSize}`);
    console.log(`  Total chunks: ${upload.totalChunks}`);
    console.log(`  Expires at: ${upload.expiresAt}`);
}
```

### Parameters

| Name             | Type                                                        | Required | Description                                |
| :--------------- | :---------------------------------------------------------- | :------- | :----------------------------------------- |
| `request`        | `TwelvelabsApi.MultipartUploadListIncompleteUploadsRequest` | Yes      | Parameters for listing incomplete uploads. |
| `requestOptions` | `MultipartUpload.RequestOptions`                            | No       | Request-specific configuration.            |

The `TwelvelabsApi.MultipartUploadListIncompleteUploadsRequest` interface has the following properties:

| Name        | Type     | Required | Description                                                           |
| ----------- | -------- | -------- | --------------------------------------------------------------------- |
| `page`      | `number` | No       | A number that identifies the page to retrieve. Default: `1`.          |
| `pageLimit` | `number` | No       | The number of items to return on each page. Default: `10`. Max: `50`. |

### Return value

Returns a `Promise` that resolves to a `Page<IncompleteUploadSummary>` object that allows you to iterate through the paginated results.

The `Page<T>` interface contains the following properties and methods:

| Name                   | Type               | Description                                                                  |
| ---------------------- | ------------------ | ---------------------------------------------------------------------------- |
| `data`                 | `T[]`              | An array containing the current page of items.                               |
| `hasNextPage()`        | `boolean`          | Returns whether there is a next page to load.                                |
| `getNextPage()`        | `Promise<Page<T>>` | Retrieves the next page and returns the updated `Page` object.               |
| `Symbol.asyncIterator` | `AsyncIterator<T>` | Allows iteration through all items across all pages using `for await` loops. |

The `TwelvelabsApi.IncompleteUploadSummary` interface contains the following properties:

| Name          | Type                                      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ------------- | ----------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uploadId`    | `string`                                  | The unique identifier of your upload session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `status`      | `TwelvelabsApi.MultipartUploadStatusType` | The current status of the upload session. Values: - `active`: The upload session is currently in progress. Continue uploading and reporting the completion of each chunk. - `completed`: The platform received the file. The asset is created in the `processing` status and is not yet ready to use. Poll the [`assets.retrieve`](/v1.3/sdk-reference/node-js/manage-assets#retrieve-an-asset) method until the `status` field is `ready` before you use the asset. - `failed`: The upload session failed. You must restart with a new session. - `expired`: The upload session expired after 24 hours. You must create a new session. |
| `totalSize`   | `number`                                  | Total size of the file in bytes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `chunkSize`   | `number`                                  | The size of each chunk in bytes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| `totalChunks` | `number`                                  | The total number of chunks in this upload session.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `createdAt`   | `Date`                                    | The date and time when the upload session was created.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `expiresAt`   | `Date`                                    | The date and time when the upload session expires.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

### API Reference

[List incomplete uploads](/v1.3/sdk-reference/node-js/upload-content/multipart-uploads#list-incomplete-uploads)

## Create a multipart upload session

**Description**: This method creates a multipart upload session for a local file.

**Supported content**: Video, audio, and images.

**Upload limits**:

* **Video and audio**: Up to 10 GB
* **Images**: Up to 32 MB

**Additional requirements** depend on your workflow:

* **Search**: [Marengo requirements](/v1.3/docs/concepts/models/marengo/marengo-3-0#video-file-requirements)
* **Video analysis**: [Pegasus requirements](/v1.3/docs/concepts/models/pegasus/pegasus-1-6#input-requirements)
* **Image analysis**: [Pegasus image requirements](/v1.3/docs/concepts/models/pegasus/pegasus-1-6#image-file-requirements)
* **Entity search**: [Marengo image requirements](/v1.3/docs/concepts/models/marengo/marengo-3-0#image-file-requirements)
* **Create embeddings**: [Marengo requirements](/v1.3/docs/concepts/models/marengo/marengo-3-5#input-requirements)

**Function signature and example**:

**`Function signature`**

```javascript Function signature
create(
    request: TwelvelabsApi.CreateAssetUploadRequest,
    requestOptions?: MultipartUpload.RequestOptions
): core.HttpResponsePromise<TwelvelabsApi.CreateAssetUploadResponse>
```

**`Node.js example`**

```javascript Node.js example
import { TwelveLabs } from "twelvelabs-js";
import fs from "fs";

const filePath = "<YOUR_FILE_PATH>";
const fileSize = fs.statSync(filePath).size;

// Create a multipart upload session
const uploadSession = await client.multipartUpload.create({
    filename: "<YOUR_FILE_NAME>",
    type: "video",
    totalSize: fileSize,
});

console.log(`Upload ID: ${uploadSession.uploadId}`);
console.log(`Asset ID: ${uploadSession.assetId}`);
console.log(`Chunk size: ${uploadSession.chunkSize}`);
console.log(`Total chunks: ${uploadSession.totalChunks}`);
console.log(`Number of initial URLs: ${uploadSession.uploadUrls.length}`);
console.log(`Expires at: ${uploadSession.expiresAt}`);
```

### Parameters

| Name             | Type                                     | Required | Description                                         |
| :--------------- | :--------------------------------------- | :------- | :-------------------------------------------------- |
| `request`        | `TwelvelabsApi.CreateAssetUploadRequest` | Yes      | Parameters for creating a multipart upload session. |
| `requestOptions` | `MultipartUpload.RequestOptions`         | No       | Request-specific configuration.                     |

The `TwelvelabsApi.CreateAssetUploadRequest` interface has the following properties:

| Name              | Type                                         | Required | Description                                                                                                                                                                                            |
| ----------------- | -------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `filename`        | `string`                                     | Yes      | The original file name of the asset.                                                                                                                                                                   |
| `type`            | `TwelvelabsApi.CreateAssetUploadRequestType` | Yes      | The type of asset you want to upload. Values: `"video"`, `"audio"`, `"image"`.                                                                                                                         |
| `totalSize`       | `number`                                     | Yes      | The total size of the file in bytes. The platform uses this value to: - Calculate the optimal chunk size. - Determine the total number of chunks required - Generate the initial set of presigned URLs |
| `enableHls`       | `boolean`                                    | No       | When set to `true`, the platform generates an HLS playlist and segments for streaming. Applicable to video and audio assets only. Default: `false`.                                                    |
| `enableThumbnail` | `boolean`                                    | No       | When set to `true`, the platform generates thumbnail images from the uploaded content. Default: `false`.                                                                                               |
| `userMetadata`    | `TwelvelabsApi.UserMetadata`                 | No       | Metadata that helps you categorize your assets. You can specify a list of keys and values. Keys are strings, and values can be a string, a number, a boolean, or an array of strings.                  |

### Return value

Returns an `HttpResponsePromise` that resolves to a `TwelvelabsApi.CreateAssetUploadResponse` object containing the upload session details.

The `TwelvelabsApi.CreateAssetUploadResponse` interface contains the following properties:

| Name            | Type                                | Description                                                                                                                                                                                                                                                                                                         |
| --------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uploadId`      | `string`                            | The unique identifier of this upload session. Store this value, as you'll need it for the following subsequent operations: - Reporting completed chunks - Requesting additional presigned URLs - Retrieving the status of this upload session This identifier remains valid for 24 hours from the time of creation. |
| `assetId`       | `string`                            | The unique identifier for the asset being created. Store this value, as you'll need it to reference the asset in other API calls. Note that this identifier is reserved immediately, but the asset becomes available for other operations only after the upload is completed successfully.                          |
| `uploadUrls`    | `TwelvelabsApi.PresignedUrlChunk[]` | The initial set of presigned URLs for uploading chunks. Each URL corresponds to a specific chunk. **NOTES**: - URLs expire after one hour. - Depending on the size of the file, this initial set may not include URLs for all chunks. You can request more using the `getAdditionalPresignedUrls` method.           |
| `uploadHeaders` | `Record<string, string>`            | Headers to include when uploading chunks to the presigned URLs.                                                                                                                                                                                                                                                     |
| `chunkSize`     | `number`                            | The size in bytes for each chunk, except for the last chunk, which may be smaller. Use this value to divide your file into chunks of this exact size.                                                                                                                                                               |
| `totalChunks`   | `number`                            | The total number of chunks into which your file must be split. Calculated as: ceiling(`totalSize` / `chunkSize`).                                                                                                                                                                                                   |
| `expiresAt`     | `Date`                              | A string representing the date and time, in RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when the upload URL will expire. Upload URLs expire 24 hours from their creation. After expiration, you cannot resume the upload, and you must create a new upload session.                                                   |

The `TwelvelabsApi.PresignedUrlChunk` interface contains the following properties:

| Name         | Type     | Description                                                                                            |
| ------------ | -------- | ------------------------------------------------------------------------------------------------------ |
| `chunkIndex` | `number` | The index of this chunk.                                                                               |
| `url`        | `string` | The presigned URL for uploading this chunk. Each URL can only be used once and expires after one hour. |
| `expiresAt`  | `Date`   | The date and time when the presigned URL expires.                                                      |

### API Reference

[Create a multipart upload session](/v1.3/api-reference/upload-content/multipart-uploads/create)

## Retrieve the status of an upload session

**Description**: This method provides information about an upload session, including its current status, chunk-level progress, and completion state.

Use this method to:

* Verify upload completion (`status` = `completed`)
* Identify any failed chunks that require a retry
* Monitor the upload progress by comparing `uploaded_size` with `total_size`
* Determine if the session has expired
* Retrieve the status information for each chunk

After you report chunk completion, call this method to confirm the upload session reached the `completed` status. This status means the platform received the file, not that the asset is ready. Poll the [`assets.retrieve`](/v1.3/sdk-reference/node-js/manage-assets#retrieve-an-asset) method until the `status` field is `ready` before you use the asset.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
getStatus(
    uploadId: string,
    request?: TwelvelabsApi.MultipartUploadGetStatusRequest,
    requestOptions?: MultipartUpload.RequestOptions
): Promise<core.Page<TwelvelabsApi.ChunkInfo>>
```

**`Node.js example`**

```javascript Node.js example
import { TwelveLabs } from "twelvelabs-js";

const response = await client.multipartUpload.getStatus(
    "<YOUR_UPLOAD_ID>",
    {
        page: 1,
        pageLimit: 50,
    }
);

console.log("Chunk status:");
for await (const chunk of response) {
    console.log(`  Chunk ${chunk.index}: ${chunk.status}`);
    if (chunk.status === "completed") {
        console.log(`    Uploaded at: ${chunk.uploadedAt}`);
    } else if (chunk.status === "failed") {
        console.log(`    Error: ${chunk.error}`);
    }
}
```

### Parameters

| Name             | Type                                            | Required                                                     | Description                                  |
| :--------------- | :---------------------------------------------- | :----------------------------------------------------------- | :------------------------------------------- |
| `uploadId`       | `string`                                        | Yes                                                          | The unique identifier of the upload session. |
| `request`        | `TwelvelabsApi.MultipartUploadGetStatusRequest` | Parameters for retrieving the status of your upload session. |                                              |
| `requestOptions` | `MultipartUpload.RequestOptions`                | No                                                           | Request-specific configuration.              |

The `TwelvelabsApi.MultipartUploadGetStatusRequest` interface has the following properties:

| Name        | Type     | Required | Description                                                           |
| ----------- | -------- | -------- | --------------------------------------------------------------------- |
| `uploadId`  | `string` | Yes      | The unique identifier of the upload session.                          |
| `page`      | `number` | No       | A number that identifies the page to retrieve. Default: `1`.          |
| `pageLimit` | `number` | No       | The number of items to return on each page. Default: `10`. Max: `50`. |

### Return value

Returns a `Promise` that resolves to a `Page<TwelvelabsApi.ChunkInfo>` object that allows you to iterate through the paginated chunk status information.

The `Page<T>` interface contains the following properties and methods:

| Name                   | Type               | Description                                                                  |
| ---------------------- | ------------------ | ---------------------------------------------------------------------------- |
| `data`                 | `T[]`              | An array containing the current page of items.                               |
| `hasNextPage()`        | `boolean`          | Returns whether there is a next page to load.                                |
| `getNextPage()`        | `Promise<Page<T>>` | Retrieves the next page and returns the updated `Page` object.               |
| `Symbol.asyncIterator` | `AsyncIterator<T>` | Allows iteration through all items across all pages using `for await` loops. |

The `ChunkInfo` interface contains the following properties:

| Name         | Type                            | Description                                                                                                                                                                                                                                                                         |
| ------------ | ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `index`      | `number`                        | The index of the chunk. The platform uses 1-based indexing, and this value matches the value of the `chunkIndex` field in the list of upload URLs.                                                                                                                                  |
| `status`     | `TwelvelabsApi.ChunkInfoStatus` | The current status of this chunk. Values: - `completed`: Successfully uploaded and reported. - `pending`: Not yet reported. A chunk may be in this status if it has been uploaded but not yet reported. - `failed`: The upload process failed; you must retry uploading this chunk. |
| `uploadedAt` | `Date`                          | The date and time, in the RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when this chunk was successfully reported as uploaded. The value of this field is `null` for pending or failed chunks.                                                                                          |
| `updatedAt`  | `Date`                          | The date and time when this chunk was last updated.                                                                                                                                                                                                                                 |
| `error`      | `string`                        | A detailed error message explaining why this chunk failed. The platform returns this field only when the status is failed.                                                                                                                                                          |

### API Reference

[Retrieve the status of an upload session](/v1.3/api-reference/upload-content/multipart-uploads/get-status)

## Report uploaded chunks

**Description**: This method reports successfully uploaded chunks to the platform. The platform finalizes the upload after you report all chunks.

For optimal performance, report chunks in batches and in any order.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
reportChunkBatch(
    uploadId: string,
    request: TwelvelabsApi.ReportChunkBatchRequest,
    requestOptions?: MultipartUpload.RequestOptions
): core.HttpResponsePromise<TwelvelabsApi.ReportChunkBatchResponse>
```

**`Node.js example`**

```javascript Node.js example
import { TwelveLabs } from "twelvelabs-js";

const response = await client.multipartUpload.reportChunkBatch(
    "<YOUR_UPLOAD_ID>",
    {
        completedChunks: [
            {
                chunkIndex: 1,
                proof: "<YOUR_PROOF_ID>",
                proofType: "etag",
                chunkSize: 5242880,
            },
            {
                chunkIndex: 2,
                proof: "<YOUR_PROOF_ID>",
                proofType: "etag",
                chunkSize: 5242880,
            },
            {
                chunkIndex: 3,
                proof: "<YOUR_PROOF_ID>",
                proofType: "etag",
                chunkSize: 5242880,
            },
        ],
    }
);

console.log(`Processed chunks: ${response.processedChunks}`);
console.log(`Duplicate chunks: ${response.duplicateChunks}`);
console.log(`Total completed: ${response.totalCompleted}`);

if (response.url) {
    console.log(`Upload complete! Asset URL: ${response.url}`);
    console.log(`Asset ID: ${response.assetId}`);
}
```

### Parameters

| Name             | Type                                    | Required | Description                                  |
| :--------------- | :-------------------------------------- | :------- | :------------------------------------------- |
| `uploadId`       | `string`                                | Yes      | The unique identifier of the upload session. |
| `request`        | `TwelvelabsApi.ReportChunkBatchRequest` | Yes      | Parameters for reporting uploaded chunks.    |
| `requestOptions` | `MultipartUpload.RequestOptions`        | No       | Request-specific configuration.              |

The `TwelvelabsApi.ReportChunkBatchRequest` interface has the following properties:

| Name              | Type                             | Required | Description                                                                                                          |   |
| ----------------- | -------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------- | - |
| `completedChunks` | `TwelvelabsApi.CompletedChunk[]` | Yes      | The list of chunks successfully uploaded that you're reporting to the platform. Report only after receiving an ETag. |   |

The `TwelvelabsApi.CompletedChunk` interface contains the following properties:

| Name         | Type                                    | Description                                                                                                                                                                                                    |
| ------------ | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `chunkIndex` | `number`                                | The number that identifies which chunk you uploaded. When you received presigned URLs from the platform, each URL was assigned an index number. Use that same number. The chunks are numbered starting from 1. |
| `proof`      | `string`                                | The ETag value you received after uploading the chunk. When you upload a chunk to a presigned URLs, the response includes an ETag. Use this value and submit it as proof of successful upload.                 |
| `proofType`  | `TwelvelabsApi.CompletedChunkProofType` | The verification method. Value: `etag`. Default: `etag`.                                                                                                                                                       |
| `chunkSize`  | `number`                                | The number of bytes uploaded for this chunk. For all chunks except the last, this value equals `chunkSize`. For the last chunk, it may be smaller.                                                             |

### Return value

Returns a `Promise` that resolves to a `TwelvelabsApi.ReportChunkBatchResponse` object containing information about the reported chunks.

The `TwelvelabsApi.ReportChunkBatchResponse` interface contains the following properties:

| Name              | Type     | Description                                                                                                                                                                                       |
| ----------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `url`             | `string` | The URL for accessing your asset. The platform returns this field only when all chunks are reported and the upload is complete. If absent, continue uploading and reporting the remaining chunks. |
| `assetId`         | `string` | The unique identifier of this asset.                                                                                                                                                              |
| `processedChunks` | `number` | The number of chunks accepted from this specific request. This equals the number of chunks in your `completedChunks` array minus any duplicates.                                                  |
| `duplicateChunks` | `number` | The number of chunks in this request that were already reported. Duplicates are ignored and don't affect your upload.                                                                             |
| `totalCompleted`  | `number` | The cumulative count of all unique chunks successfully reported across all requests. When this equals `totalChunks`, the upload is complete.                                                      |

### API Reference

[Report uploaded chunks](/v1.3/api-reference/upload-content/multipart-uploads/report-chunk-batch)

## Request presigned URLs for the remaining chunks

**Description**: This method generates new presigned URLs for specific chunks that require uploading. Use this method in the following situations:

* Your initial URLs have expired (URLs expire after one hour).
* The initial set of presigned URLs does not include URLs for all chunks.
* You need to retry failed chunk uploads with new URLs.

To specify which chunks need URLs, use the `start` and `count` parameters. For example, to generate URLs for chunks 21 to 30, use `start=21` and `count=10`.

The response provides new URLs, each with a fresh expiration time of one hour.

**Function signature and example**:

**`Function signature`**

```javascript Function signature
getAdditionalPresignedUrls(
    uploadId: string,
    request: TwelvelabsApi.RequestAdditionalPresignedUrLsRequest,
    requestOptions?: MultipartUpload.RequestOptions
): core.HttpResponsePromise<TwelvelabsApi.RequestAdditionalPresignedUrLsResponse>
```

**`Request additional URLs`**

```javascript Request additional URLs
import { TwelveLabs } from "twelvelabs-js";


const response = await client.multipartUpload.getAdditionalPresignedUrls(
    "<YOUR_UPLOAD_ID>",
    {
        start: 21,
        count: 10,
    }
);

console.log(`Upload ID: ${response.uploadId}`);
console.log(`Start index: ${response.startIndex}`);
console.log(`Count: ${response.count}`);
console.log(`Generated at: ${response.generatedAt}`);
console.log(`Expires at: ${response.expiresAt}`);

// Use the presigned URLs to upload chunks
for (const urlChunk of response.uploadUrls) {
    console.log(`Chunk ${urlChunk.chunkIndex}: ${urlChunk.url}`);
}
```

### Parameters

| Name             | Type                                                  | Required | Description                                                        |
| :--------------- | :---------------------------------------------------- | :------- | :----------------------------------------------------------------- |
| `uploadId`       | `string`                                              | Yes      | The unique identifier of the upload session.                       |
| `request`        | `TwelvelabsApi.RequestAdditionalPresignedUrLsRequest` | Yes      | Parameters for requesting presigned URLs for the remaining chunks. |
| `requestOptions` | `MultipartUpload.RequestOptions`                      | No       | Request-specific configuration.                                    |

The `TwelvelabsApi.RequestAdditionalPresignedUrLsRequest` interface has the following properties:

| Name       | Type     | Required | Description                                                                                                                  |
| ---------- | -------- | -------- | ---------------------------------------------------------------------------------------------------------------------------- |
| `uploadId` | `string` | Yes      | The unique identifier of the upload session.                                                                                 |
| `start`    | `number` | Yes      | The index of the first chunk number to generate URLs for. Chunks are numbered from 1.                                        |
| `count`    | `number` | Yes      | The number of presigned URLs to generate starting from the index. You can request a maximum of 50 URLs in a single API call. |

### Return value

Returns an `HttpResponsePromise` that resolves to a `TwelvelabsApi.RequestAdditionalPresignedUrLsResponse` object containing the new presigned URLs.

The `TwelvelabsApi.RequestAdditionalPresignedUrLsResponse` interface contains the following properties:

| Name          | Type                                | Description                                                                                                                                    |
| ------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `uploadId`    | `string`                            | The unique identifier of the upload session associated with these URLs.                                                                        |
| `startIndex`  | `number`                            | The index of the first chunk number in this set of URLs. Matches the start value from your request.                                            |
| `count`       | `number`                            | The number of new URLs created. Matches the count value from your request.                                                                     |
| `uploadUrls`  | `TwelvelabsApi.PresignedUrlChunk[]` | An array of additional presigned URLs for uploading chunks.                                                                                    |
| `generatedAt` | `Date`                              | The date and time, in the RFC 3339 format ("YYYY-MM-DDTHH:mm:ssZ"), when these URLs were created. URLs remain valid for 1 hour from this time. |
| `expiresAt`   | `Date`                              | The date and time when the upload session expires.                                                                                             |

The `TwelvelabsApi.PresignedUrlChunk` interface contains the following properties:

| Name         | Type     | Description                                                                                          |
| ------------ | -------- | ---------------------------------------------------------------------------------------------------- |
| `chunkIndex` | `number` | The index of this chunk.                                                                             |
| `url`        | `string` | The presigned URL for uploading this chunk. Each URL can only be used once and expires after 1 hour. |
| `expiresAt`  | `Date`   | The date and time when this presigned URL expires.                                                   |

### API Reference

[Request presigned URLs for the remaining chunks](/v1.3/api-reference/upload-content/multipart-uploads/get-additional-presigned-urls)