Run Addons on products
Start an Addon for a product you imported, or one of its variants, without uploading a photo: the run starts from the product's shop image. When it succeeds, its images and videos belong to the product, next to the shop's.
Before you start
- An API key with
runs:createandproducts:read(Authentication). - Products in a catalog (Import products), with their
shop images loaded:
imagesLoadingisfalseinlistProducts.
1. Pick an Addon that runs on products
An Addon that runs on products lists an input of type product in
listAddons. Its fills names the
photo input the product's shop image goes into.
2. Start the run
Pass the product's id from listProducts as that input and leave the
photo input out, as described in Start runs:
{
"addonId": "…",
"inputs": { "product": { "productId": "0193…" } },
"maxCredits": 10,
"idempotencyKey": "…"
}
The run starts from the product's main image. Add variant, a variant's
externalId from
getProduct,
to run on that variant: it starts from the variant's first image. Add
image, a shop image's position, to start from another one. A photo you
pass yourself wins over the shop image, and the run still belongs to the
product.
| Answer | What it means |
|---|---|
404 not_found | The account has no such product or variant. |
409 orchestrator.product_image_not_ready | The shop image is still loading, failed or missing (details.state): pick another image or pass a photo. |
For several products, start a batch with one item per
product: { "inputs": { "product": { "productId": "…" } } }.
3. Read the results on the product
Follow the run as in Follow runs. Once it succeeded,
getProduct
lists its images and videos in assets, each with run (runId,
addonId) and, for a run on a variant, that variant's variant. The shop's
own images are in images; a variant's are the ones at its
imagePositions. listProducts counts each product's results in
generatedImages.
Every succeeded run's results are linked, also those its quality check did
not approve and both sides of a redo; unlink what you do not want with
unlinkProductAsset.
A new import of the catalog keeps them.