Reorder images
PUT/v1/products/{id}/images/order
scope products.write
Ids you do not name keep their relative order after the ones you do. The first is the primary image.
Request body#
| Field | Type | Required | Description |
|---|---|---|---|
image_ids | integer[] | required | Image ids in the order you want them, first one being the listing's main photo. Ids come from GET /v1/products/{id}. An id that does not belong to this product is skipped rather than failing the call, and any image you leave out keeps its place after the ones you listed — so you can move a single photo to the front without sending the whole set. |
Example
{
"image_ids": [
108876841,
108876840,
108876839
]
}Response#
| Field | Type | Description |
|---|---|---|
images | array | The listing's images AFTER the change, already in display order — so you never need a follow-up read to see the result. |
images[]. | integer | The image id, for reordering and deletion. |
images[]. | integer | Its place, 0 being the main photo. |
images[]. | string|null | Where the file sits in our storage, when we host it. |
images[]. | string|null | The URL we serve it FROM, when you attached it by link. Exactly one of these two is set. |
Example
{
"images": [
{
"id": 108876841,
"position": 0,
"path": "files/237224/mtb-front.jpg",
"source_url": null
},
{
"id": 108876840,
"position": 1,
"path": null,
"source_url": "https://cdn.example.com/erp/mtb-side.jpg"
}
]
}