Tools
Media
Browse the library with its filters, read a file's facts and readiness, inspect its usage, retrieve an image's bytes for external editing, and check a filename (read); upload a new file and attach or reorder attachments (write); and run the replacement workflow — stage, commit, cancel — which is publish-tier because committing enqueues the owners' publish. Deleting or detaching a file is not offered.
list_media_v1
list_media_v1pim:readList the account's READY files with the library's filters: search (filename, tags, alt text), tags (any of), usage "unused", the structured filter, store presence, sort (master fields or created_at/updated_at), and paging. Each row carries the file's facts as attributes (Filename, Content Type, Width, Height, Byte Size, Media Type, Media Status), where it is used (usage_count), and a thumbnail; with channel_id also its version on that store (Alt Text, Shopify Media GID). A file still uploading (Media Status pending) is not listed — read it with get_media_v1.
| Argument | Type | Description |
|---|---|---|
channel_id | string | Include each file's version on this store. |
filter | object | Structured filter. A condition the server cannot apply (unknown operator, blank value on a value-taking operator, a store-scoped condition without a store) is SKIPPED rather than rejected, so verify the population before trusting a count. |
order | string, one of asc, desc | Sort direction. |
page | integer | 1-based page number. |
page_size | integer | Rows per page (clamped to the server max). |
reference_channel_ids | array of string | Also return each file's GID on these stores. |
search | string | Free-text search over filename, tags, and alt text. |
sort | string | Sort field key. |
sort_source | string, one of master, projection, master_column, projection_column, default_variant | Which side the sort key lives on: "master", "projection" (needs channel_id), "master_column" (created_at/updated_at), or "projection_column" (last_publish_at). |
sort_type | string, one of string, number, date | How sort values compare. |
store_ids | array of string | Restrict by store presence to these store ids (see store_mode). |
store_mode | string, one of any, all, only, none | How store_ids applies: "any" (on at least one, default), "all" (on every listed store), "only" (on exactly those), "none" (on none of them). |
tags | array of string | Only files carrying any of these tags. |
usage | string, one of unused | "unused": only files attached to nothing. |
get_media_v1
get_media_v1pim:readGet one file's shared record: its facts as attributes (Filename, Content Type, Width, Height, Byte Size, Media Type, Media Status — "pending" while uploading, "ready" once confirmed — Tags, Preview Only for files that live in Shopify), its publish state, and a full-resolution thumbnail URL. Per-store alt text and Shopify media ids live on its store versions (get_master_with_projections_v1). Edit Filename or Tags with update_master_attributes_v1 and Alt Text with update_projection_attributes_v1; storage keys are write-protected.
| Argument | Type | Description |
|---|---|---|
id | string, required | The item id (must belong to the token's account; cross-account ids return not found). |
get_media_usage_v1
get_media_usage_v1pim:readList the entities a file is attached to: across every store (distinct products, collections, and articles — a variant's attachment counts for its product), or on one store with channel_id (each attachment's link id, whether it still awaits publish, and variants as their own rows).
| Argument | Type | Description |
|---|---|---|
id | string, required | The file id. |
channel_id | string | Narrow to one store's attachments. |
get_media_content_v1
get_media_content_v1pim:readRetrieve a ready JPEG, PNG, or WebP image's original bytes (returned as image content) so it can be inspected or edited externally, then replaced through the replacement tools. Files still uploading, GIFs, videos, and files that live in Shopify are refused. Images over the attachment budget (8 MiB) cannot be returned.
| Argument | Type | Description |
|---|---|---|
id | string, required | The item id (must belong to the token's account; cross-account ids return not found). |
- Extended timeout. 120 s per call — the operation runs server-side orchestration or a live Shopify read.
check_media_filename_v1
check_media_filename_v1pim:readBefore renaming a file, check the sanitized filename the publish would send, which stores already hold a different file under that name (Shopify requires unique filenames per store — read live), and the nearest free variant when there is a conflict.
| Argument | Type | Description |
|---|---|---|
filename | string, required | The filename to check. |
id | string, required | The file id. |
- Live Shopify read. Slower than PIM reads and can fail when Shopify is unavailable.
request_media_upload_v1
request_media_upload_v1pim:writeStep 1 of uploading a new file: declare its filename, content type (JPEG, PNG, GIF, WebP, MP4, QuickTime) and size (at most 20 MiB) and get back the new file id plus a short-lived upload URL. The bytes must then be PUT to that URL with the same Content-Type and Content-Length, and the upload finished with confirm_media_upload_v1. Until confirmed the file is not ready and not listed.
| Argument | Type | Description |
|---|---|---|
byte_size | integer, required | The exact size in bytes (at most 20971520). |
content_type | string, one of image/jpeg, image/png, image/gif, image/webp, video/mp4, video/quicktime, required | The file's content type. |
filename | string, required | The filename. |
- Drafts only. Changes land in Peak PIM; nothing reaches Shopify until a publish.
confirm_media_upload_v1
confirm_media_upload_v1pim:writeStep 2 of uploading: after the bytes were PUT to the upload URL, verify them server-side (type, size, dimensions are read from the object itself) and mark the file ready. width/height are advisory, used only when the server cannot measure (videos). The file is then browsable and attachable; it reaches Shopify when an entity it is attached to publishes.
| Argument | Type | Description |
|---|---|---|
id | string, required | The file id request_media_upload_v1 returned. |
height | integer | Advisory height in pixels. |
width | integer | Advisory width in pixels. |
- Drafts only. Changes land in Peak PIM; nothing reaches Shopify until a publish.
create_projection_link_v1
create_projection_link_v1pim:writeCreate an authored relationship link between two per-store versions on the same store: attach an existing file to a product, variant, collection, or article version (target = the file's version on that store), or attach a product to a catalog. position -1 appends after the last link; a non-negative position is stored as given. Collection → product pairs are refused (membership comes from the collection's sources). The link awaits the source entity's next publish.
| Argument | Type | Description |
|---|---|---|
source_projection_id | string, required | The entity's per-store version (the product, variant, collection, article, or catalog version). |
target_projection_id | string, required | The linked per-store version (the file's, market's, or product's version on the same store). |
position | integer | Order position; -1 appends (default). |
- Drafts only. Changes land in Peak PIM; nothing reaches Shopify until a publish.
update_projection_link_v1
update_projection_link_v1pim:writeRewrite one authored link: its position (to reorder a gallery — every link's position is stored as given, sibling positions are not shifted) and/or its endpoints (to move a file onto another entity version, or swap which file a slot holds). All three fields are written as a whole; read the link first and resend the endpoints you keep. The entity's publish then reconciles the change.
| Argument | Type | Description |
|---|---|---|
id | string, required | The link id. |
position | integer, required | The position to store. |
source_projection_id | string, required | The entity's per-store version. |
target_projection_id | string, required | The linked per-store version. |
- Drafts only. Changes land in Peak PIM; nothing reaches Shopify until a publish.
request_media_replacement_v1
request_media_replacement_v1pim:publishStep 1 of replacing a ready image's bytes (JPEG, PNG, GIF, WebP only; files that live in Shopify cannot be replaced): declare the new filename, content type and size, and the file's current draft_revision as base_revision (a stale revision answers 409 — reload the file). Returns a replacement session (1 hour) and an upload URL the new bytes must be PUT to; then commit_media_replacement_v1 or cancel_media_replacement_v1. Pass the same idempotency_key to the commit so a retried commit replays instead of erroring.
| Argument | Type | Description |
|---|---|---|
base_revision | integer, required | The file's current draft_revision. |
byte_size | integer, required | The exact size in bytes (at most 20971520). |
content_type | string, one of image/jpeg, image/png, image/gif, image/webp, required | The new bytes' content type. |
filename | string, required | The new filename. |
id | string, required | The file id. |
idempotency_key | string | Optional caller key reused on the commit. |
- Reaches your stores. Annotated open-world and destructive; the in-app assistant always asks for confirmation before running it.
commit_media_replacement_v1
commit_media_replacement_v1pim:publishStep 2 of replacing a file: after the new bytes were PUT to the session's upload URL, verify them, make them the file's canonical bytes in the PIM, and ENQUEUE the background publish that sends the replacement to every store the file is on (its owners are re-published). The result carries the updated file and the accepted operation — poll get_publish_operation_v1 and read per-store outcomes with get_publish_failures_v1. The commit is never rolled back on a store failure: failed stores stay pending and retry on their next publish.
| Argument | Type | Description |
|---|---|---|
id | string, required | The file id. |
session_id | string, required | The replacement session from request_media_replacement_v1. |
applied_operations | array of string | What was done to the image (crop, rotate, …), for the change history. |
height | integer | Advisory height in pixels. |
idempotency_key | string | The same key given to the stage step, if any. |
width | integer | Advisory width in pixels. |
- Extended timeout. 120 s per call — the operation runs server-side orchestration or a live Shopify read.
- Reaches your stores. Annotated open-world and destructive; the in-app assistant always asks for confirmation before running it.
cancel_media_replacement_v1
cancel_media_replacement_v1pim:publishDiscard a staged replacement session so its uploaded bytes are never committed. Always succeeds, including for a session that already expired.
| Argument | Type | Description |
|---|---|---|
id | string, required | The file id. |
session_id | string, required | The replacement session to discard. |
- Reaches your stores. Annotated open-world and destructive; the in-app assistant always asks for confirmation before running it.