---
title: "Append product photos (upload or import by URL)"
method: POST
path: "/api/admin/components/{id}/gallery"
tags: ["admin-components"]
---

# Append product photos (upload or import by URL)

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

## Request

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

Appends images to the `gallery` file field (`gallery+`); stored images stay in place.

- `Content-Type: application/json` expects `{ urls }`: the server downloads every http(s) URL (15 s timeout each). Any failed download answers 400 with the message of the first failure.
- Any other content type is read as `multipart/form-data`; every `files` part is one image.

A component holds at most 8 images in total; each image must be at most 5 MB and of type image/png, image/jpeg, image/webp, image/avif, image/svg+xml. On success the cached component reads and the public pages `/components` and `/components/<slug>` are revalidated.

## Request body

- AdminComponentGalleryImport: Images for the server to download (research suggestions).
  - `urls` string[], required

## Response `200`

Gallery after the append.

- 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`: Nothing usable received, limit exceeded, wrong type, too large or download failed.
- `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`: Unknown `id`, unreadable multipart body 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)
