> For the complete documentation index, see [llms.txt](https://docs.flowretail.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowretail.com/docs/developers/api-documentation/product-media/set-all-media-for-a-product.md).

# Set all media for a product

Set all the media items for a product in one go. The payload is an array refelecting all the media on the given product. In addition to adding the new entries, this will also remove any exising entries that are not in the payload. So an empty array will delete all the product media on the product.

An item with a `productMediaUid` names that media; an item without one names the media the product already has with the same `mainUrl`. An item that changes nothing is not written, so sending the same list again leaves the media, their uids and the cover image as they are and sends no webhook.

If no media is set as cover image, the first media added will be used. Only one image can be set as the cover image.

Required permissions: PRODUCT

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"ProductMedia","description":"ProductMedia"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"ProductMediaBatchRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/ProductMediaCreateSchema"}}},"required":["items"]}}}}},"schemas":{"ProductMediaCreateSchema":{"title":"ProductMediaCreateSchema","type":"object","properties":{"mainUrl":{"type":"string"},"thumbnailUrl":{"type":"string"},"position":{"type":"integer"},"setAsCoverImage":{"type":"boolean"},"productMediaUid":{"$ref":"#/components/schemas/OptionalUID"}},"required":["mainUrl"]},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}}},"paths":{"/tenants/{tenantUid}/products/{productUid}/media/batch":{"post":{"summary":"Set all media for a product","operationId":"post-product-media-batch","responses":{"204":{"description":"No Content"}},"description":"Set all the media items for a product in one go. The payload is an array refelecting all the media on the given product. In addition to adding the new entries, this will also remove any exising entries that are not in the payload. So an empty array will delete all the product media on the product.\n\nAn item with a `productMediaUid` names that media; an item without one names the media the product already has with the same `mainUrl`. An item that changes nothing is not written, so sending the same list again leaves the media, their uids and the cover image as they are and sends no webhook.\n\nIf no media is set as cover image, the first media added will be used. Only one image can be set as the cover image.\n\nRequired permissions: PRODUCT","requestBody":{"$ref":"#/components/requestBodies/ProductMediaBatchRequest"},"tags":["ProductMedia"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flowretail.com/docs/developers/api-documentation/product-media/set-all-media-for-a-product.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
