# Download ## Request Batch `assets.download.request_batch(DownloadRequestBatchParams**kwargs) -> DownloadRequestBatchResponse` **post** `/assets/download` Request a link to batch download assets (batch limited to 1000 assets) ### Parameters - `options: Options` - `file_name_template: str` 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: Optional[bool]` Flag to prevent grouping assets in directories and store them flat - `query: Query` - `asset_ids: Sequence[str]` Every individual assets specified will be included in the archive - `inference_ids: Sequence[str]` All assets issued from the provided inference ids will be included in the archive - `model_ids: Sequence[str]` All assets issued from the provided model ids will be included in the archive ### Returns - `class DownloadRequestBatchResponse: …` - `job_id: str` The job id associated with the download request ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) response = client.assets.download.request_batch( options={ "file_name_template": "fileNameTemplate" }, query={ "asset_ids": ["string"], "inference_ids": ["string"], "model_ids": ["string"], }, ) print(response.job_id) ``` #### Response ```json { "jobId": "jobId" } ``` ## Get Status `assets.download.get_status(strjob_id) -> DownloadGetStatusResponse` **get** `/assets/download/{jobId}` Retrieve the status and the url of a batch download assets request ### Parameters - `job_id: str` ### Returns - `class DownloadGetStatusResponse: …` - `job_id: str` The job id associated with the download request - `job_status: str` The current job status - `download_url: Optional[str]` The download url ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) response = client.assets.download.get_status( "jobId", ) print(response.job_id) ``` #### Response ```json { "jobId": "jobId", "jobStatus": "jobStatus", "downloadUrl": "downloadUrl" } ``` ## Request `assets.download.request(strasset_id, DownloadRequestParams**kwargs) -> DownloadRequestResponse` **post** `/assets/{assetId}/download` Request a link to download the given `assetId` in the given `targetFormat` ### Parameters - `asset_id: str` - `target_format: Optional[Literal["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 - `class DownloadRequestResponse: …` - `url: str` The signed URL to download the asset in the given format ### Example ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), # This is the default and can be omitted api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), # This is the default and can be omitted ) response = client.assets.download.request( asset_id="assetId", ) print(response.url) ``` #### Response ```json { "url": "url" } ``` ## Domain Types ### Download Request Batch Response - `class DownloadRequestBatchResponse: …` - `job_id: str` The job id associated with the download request ### Download Get Status Response - `class DownloadGetStatusResponse: …` - `job_id: str` The job id associated with the download request - `job_status: str` The current job status - `download_url: Optional[str]` The download url ### Download Request Response - `class DownloadRequestResponse: …` - `url: str` The signed URL to download the asset in the given format