> ## Documentation Index
> Fetch the complete documentation index at: https://docs.closient.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Product Images

> Upload, list, and delete a product's images — the programmatic equivalent of the dashboard's images page.

Programmatic equivalent of the dashboard's `products/<gtin>/images/` page
(and its `images/new/`, `images/<id>/edit/`, `images/<id>/delete/`
sub-pages).

## When to use

* A brand owner needs to add, review, or remove images attached to a
  product.

## Auth

`X-API-Key` header or OAuth token with `dashboard:write` scope. The caller
must be a member of `organization_id` and hold the
`organization.contribute_organization` permission on their membership; the
product must be owned by that organization.

## Flow

```
GET    /dashboard/api/v1/trade-items/{organization_id}/{gtin}/images
POST   /dashboard/api/v1/trade-items/{organization_id}/{gtin}/images
DELETE /dashboard/api/v1/trade-items/{organization_id}/{gtin}/images/{image_id}
```

* **List** — paginated, primary image first, then ascending `priority`, then
  most-recent upload.
* **Upload** (`multipart/form-data`) — accepts JPEG, PNG, GIF, WebP, SVG, or
  BMP. When the uploaded image is marked `is_primary`, the previously primary
  image (if any) is automatically demoted, so at most one image per product
  carries the flag.
* **Delete** — removes a single image row; `image_id` must belong to the
  targeted product.

Returns `201` on upload with the created image row, `403` for a caller
missing the contribute permission, `404` for a GTIN/image not owned by
`organization_id`, `422` for an unsupported file type.

## Notes

The Dashboard API (`/dashboard/api/v1/...`) is internal-only tooling powering
this dashboard, not a general-purpose external integration surface — but it
is the real, documented write path for this workflow and safe to call with a
scoped `dashboard:write` token.
