Skip to content

Run a prompt against assets

Request

Run a prompt once per Asset selected by the specified assets selector, supplying all available context about each asset to the model.

Use the BY_IDS selector to run the prompt for a specific list of Asset.ids, or the BY_CRITERION selector to run it for a search criterion, e.g. all Assets in a specific folder. See AssetSearch for more detail on the available criterion.

At most 500 assets can be selected; larger selections are rejected with a 400.

The completed job's result maps each successfully processed asset ID to the model's output, and each failed asset ID to a failure reason.

Security
bearerToken
Bodyapplication/jsonrequired
promptstring, <= 2000 charactersrequired

The instructions given to the model, run once per selected Asset. All available context about the asset (filename, file type, metadata values, assigned products and variants, and an image of the asset where one is available) is supplied to the model alongside the prompt.

Example:"Write concise alt text describing the image for screen reader users."
selectoranyrequired
curl -i -X POST \
  https://api-v2.dash.app/asset-prompt-batch-jobs \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "prompt": "Write concise alt text describing the image for screen reader users.",
    "selector": {
      "type": "BY_CRITERION",
      "criterion": {
        "type": "FIELD_EQUALS",
        "value": "Folder",
        "field": {
          "type": "FIXED",
          "fieldName": "STAGED_BY"
        },
        "includeDescendants": true,
        "boost": null
      }
    }
  }'

Responses

Success

Bodyapplication/json
idstringrequired

Unique identifier of the job that has been created

Example:"be161977-d44e-4888-af3c-66522e223963"
accountIdstringrequired

The ID of the account the job is happening in

Example:"cfb665ca-ce35-4418-b9d5-70ee815db4bd"
creatorIdstringrequired

The ID of the User who created the job

Example:"google-oauth2|110955770826801837334"
typestringrequired

The job type

Value:"IN_PROGRESS"
Discriminator
progressobjectrequired
statusstringrequired
Enum:"PENDING""STARTING""STARTED""STOPPING"
resultobjectrequired

The outputs generated so far, allowing partial results to be displayed while the job is still running. The successes and failures are empty until any assets have been processed.

Response
{ "id": "be161977-d44e-4888-af3c-66522e223963", "accountId": "cfb665ca-ce35-4418-b9d5-70ee815db4bd", "creatorId": "google-oauth2|110955770826801837334", "type": "IN_PROGRESS", "status": "PENDING", "progress": { "steps": [ … ] } }