Skip to content

Product Images — Upload

Uploads a new image for the given product.

Image upload is REST-only. A binary file part cannot be carried in a JSON GraphQL request, so the createAdminCatalogProductImage mutation exists as a placeholder and rejects any call. Reordering and deleting images, which carry no binary payload, do work over GraphQL.

Endpoint

EndpointMethod
/api/admin/catalog/products/{productId}/imagesPOST

Content type

multipart/form-data — required.

Form fields

FieldTypeRequiredNotes
imagefileyesOne of bmp, jpeg, jpg, png, webp.
positionintegernoSort position; appended to the end if omitted.
alt_textstringnoDescription of the image, stored for every locale the request covers. Editable afterwards through update.

Response

201 Created

FieldTypeNotes
idintegerNew product_images.id.
productIdintegerParent product ID (echoed).
pathstringStorage-relative file path.
positionintegerSort position.
urlstringPublic URL.
altTextstringAlt text stored for the current locale, or null.

Errors

HTTPCause
401 UnauthorizedMissing or invalid admin Bearer token.
403 ForbiddenAdmin role lacks catalog.products.edit.
404 Not FoundProduct not found.
422 Unprocessable EntityMissing file, invalid mime, or oversized payload.

Released under the MIT License.