# Download ## Request Batch `client.assets.download.requestBatch(DownloadRequestBatchParamsbody, RequestOptionsoptions?): DownloadRequestBatchResponse` **post** `/assets/download` Request a link to batch download assets (batch limited to 1000 assets) ### Parameters - `body: DownloadRequestBatchParams` - `options: Options` - `fileNameTemplate: string` A file naming convention as a string with the following available parameters: (seed used to generate the asset) (index of the asset in the inference) (prompt of the inference) (prompt of the generator) Example: "---" - `flat?: boolean` Flag to prevent grouping assets in directories and store them flat - `query: Query` - `assetIds: Array` Every individual assets specified will be included in the archive - `inferenceIds: Array` All assets issued from the provided inference ids will be included in the archive - `modelIds: Array` All assets issued from the provided model ids will be included in the archive ### Returns - `DownloadRequestBatchResponse` - `jobId: string` The job id associated with the download request ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const response = await client.assets.download.requestBatch({ options: { fileNameTemplate: 'fileNameTemplate' }, query: { assetIds: ['string'], inferenceIds: ['string'], modelIds: ['string'], }, }); console.log(response.jobId); ``` #### Response ```json { "jobId": "jobId" } ``` ## Get Status `client.assets.download.getStatus(stringjobID, RequestOptionsoptions?): DownloadGetStatusResponse` **get** `/assets/download/{jobId}` Retrieve the status and the url of a batch download assets request ### Parameters - `jobID: string` ### Returns - `DownloadGetStatusResponse` - `jobId: string` The job id associated with the download request - `jobStatus: string` The current job status - `downloadUrl?: string` The download url ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const response = await client.assets.download.getStatus('jobId'); console.log(response.jobId); ``` #### Response ```json { "jobId": "jobId", "jobStatus": "jobStatus", "downloadUrl": "downloadUrl" } ``` ## Request `client.assets.download.request(stringassetID, DownloadRequestParamsbody, RequestOptionsoptions?): DownloadRequestResponse` **post** `/assets/{assetId}/download` Request a link to download the given `assetId` in the given `targetFormat` ### Parameters - `assetID: string` - `body: DownloadRequestParams` - `targetFormat?: "gif" | "heif" | "jpeg" | 10 more` The format to download the asset in - `"gif"` - `"heif"` - `"jpeg"` - `"jpg"` - `"png"` - `"svg"` - `"webp"` - `"avif"` - `"tif"` - `"tiff"` - `"glb"` - `"fbx"` - `"obj"` ### Returns - `DownloadRequestResponse` - `url: string` The signed URL to download the asset in the given format ### Example ```typescript import Scenario from '@scenario-labs/sdk'; const client = new Scenario({ apiKey: process.env['SCENARIO_SDK_API_KEY'], // This is the default and can be omitted apiSecret: process.env['SCENARIO_SDK_API_SECRET'], // This is the default and can be omitted }); const response = await client.assets.download.request('assetId'); console.log(response.url); ``` #### Response ```json { "url": "url" } ``` ## Domain Types ### Download Request Batch Response - `DownloadRequestBatchResponse` - `jobId: string` The job id associated with the download request ### Download Get Status Response - `DownloadGetStatusResponse` - `jobId: string` The job id associated with the download request - `jobStatus: string` The current job status - `downloadUrl?: string` The download url ### Download Request Response - `DownloadRequestResponse` - `url: string` The signed URL to download the asset in the given format