Search Documentation
Search for a documentation page...
Media API
REST API endpoints for managing the store's media library.
The media library is the store's catalog of uploaded images, video, and documents. Add files by uploading them directly or by pointing at remote URLs (re-hosted on the store CDN), then attach them to products, variants, or collections.
List Media
Returns a paginated list of the store's media, newest first. Filter by kind and search filename or alt text with query.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 24 | Items per page (1-100) |
offset | number | 0 | Items to skip |
kind | "image" | "video" | "document" | — | Filter by media kind |
query | string | — | Search by filename or alt text |
Response
Create Media
Adds media to the library in one of two modes, chosen by the request Content-Type.
File upload (multipart/form-data) — upload file(s) under the file field; repeat the field for multiple files. Maximum 10 files, 25 MB each.
Remote URLs (application/json) — pass { "urls": [...] } to fetch remote images and re-host them on the store CDN (images only).
Both modes catalog the result and return the created rows under media.
Request Body (JSON mode)
| Field | Type | Required | Description |
|---|---|---|---|
urls | string[] | Yes | Remote image URLs to fetch and add (min 1) |
Response (201)
Get Media
Returns a single media item by ID. Returns 404 if it does not exist in this store.
Update Media
Updates editable metadata. Send at least one field — an empty body returns 400.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
filename | string | No | Display filename (min 1 char) |
alt | string | null | No | Alt text for accessibility (null to clear) |
Response (200)
Returns the updated media item.
Delete Media
Removes the media row and best-effort deletes the underlying blob. If the asset is still attached to one or more products, variants, or collections, the request returns 409 with the list of usedBy entities. Pass ?force=true to delete anyway — the URL is stripped from every entity that references it.
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
force | boolean | false | Delete even if the asset is still attached |
Response (204)
Empty body on success.