---
title: "Reorder the product photos"
method: PATCH
path: "/api/admin/components/{id}/gallery"
tags: ["admin-components"]
---

# Reorder the product photos

`PATCH /api/admin/components/{id}/gallery`

## Request

- Base URL: `https://voltplan.app`
- URL: `https://voltplan.app/api/admin/components/{id}/gallery`
- Auth: HTTP bearer

Restates the `gallery` filenames in a new order. `order` must be a permutation of the stored filenames, so nothing can be dropped or added; the first image is the one the detail page and the catalogue card show. On success the cached component reads and the public pages `/components` and `/components/<slug>` are revalidated.

## Request body

- AdminComponentGalleryReorder
  - `order` string[], required: All stored filenames in the new order (a permutation of `gallery`).

## Response `200`

Gallery in the new order.

- AdminComponentGallery
  - `success` unknown, required
  - `gallery` string[], required: Stored filenames in display order; the first one is the cover image.
  - `urls` string[], required: Public file URLs `<PocketBase>/api/files/<collectionId>/<id>/<filename>`, same order as `gallery`.

## Other responses

- `400`: `order` is not a string array or not a permutation of the stored files.
- `403`: Admin access required. Returned for a missing, invalid or expired bearer token as well as for a valid token whose user lacks `is_admin=true`; admin endpoints never answer 401.
- `500`: Invalid JSON, unknown `id` or PocketBase write failed.

---

[API](https://skmtc.dev/voltplan/apis/voltplan-api.md) · [All operations](https://skmtc.dev/voltplan/apis/voltplan-api/llms.txt) · [OpenAPI document](https://skmtc.dev/voltplan/apis/voltplan-api/revisions/575b86a7af92?raw)
