Skip to content
Get started

Request Batch

client.assets.download.requestBatch(DownloadRequestBatchParams { options, query, dryRun, projectId } params, RequestOptionsoptions?): DownloadRequestBatchResponse { jobId }
POST/assets/download

Request a link to batch download assets (batch limited to 1000 assets)

ParametersExpand Collapse
params: DownloadRequestBatchParams { options, query, dryRun, projectId }
options: Options

Body param

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) (slug of the inference prompt: lower-cased, function words removed, max 8 words, joined with _) (name of the generator) (asset id) (slug of the asset description or caption: lower-cased, function words removed, max 8 words, joined with _. Does not fall back to the prompt.) A / in the template creates a subdirectory (e.g. <prompt>/<id> → cat_dancing/asset_….png). Later occurrences of the same dynamic token are dropped together with their preceding separator. The filename, including the extension, is capped at 128 characters; each template directory segment is capped at 64. Prompt and description are truncated first. Example: ”-”

archiveName?: string

Name of the downloaded zip file, without the .zip extension. Defaults to <YYYYMMDD>-export.

maxLength128
flat?: boolean

Flag to prevent grouping assets in directories and store them flat

preferOriginal?: boolean

Flag to archive the file as it was originally uploaded, for assets whose upload was re-encoded on creation (e.g. a .mov stored as mp4). Each archived file is named with the extension of the format it contains.

Assets that have no preserved original (every image, and anything uploaded in a format we serve as-is) are archived unchanged, so this is a preference and never fails a download.

query: Query

Body param

assetIds: Array<string>

Every individual assets specified will be included in the archive

inferenceIds: Array<string>

All assets issued from the provided inference ids will be included in the archive

modelIds: Array<string>

All assets issued from the provided model ids will be included in the archive

dryRun?: "true" | "api"

Query param: Estimate the operation instead of running it: the call returns a 269 response carrying the creative units cost. api estimates at the API tier.

One of the following:
"true"
"api"
projectId?: string

Query param: The projectId used for ownership resource management. Either to assert ownership or to set the owner of the resource(s)

ReturnsExpand Collapse
DownloadRequestBatchResponse { jobId }
jobId: string

The job id associated with the download request

Request Batch

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);
{
  "jobId": "jobId"
}
Returns Examples
{
  "jobId": "jobId"
}