Skip to content
Saleor
Esc
↑↓navigate↵open⌘Jpreview

Schema: Saleor 3.23.43Download SDLUpgrade guides

On this page

ProductMedia Object

Represents a product media.

type ProductMedia implements Node & ObjectWithMetadata {
  id: ID!
  privateMetadata: [MetadataItem!]!
  privateMetafield(key: String!): String
  privateMetafields(keys: [String!]): Metadata
  metadata: [MetadataItem!]!
  metafield(key: String!): String
  metafields(keys: [String!]): Metadata
  sortOrder: Int
  alt: String!
  translation(languageCode: LanguageCodeEnum!): ProductMediaTranslation
  type: ProductMediaType!
  oembedData: JSONString!
  url(size: Int, sizeRounding: ThumbnailSizeRoundingEnum = NEAREST, format: ThumbnailFormatEnum = ORIGINAL): String!
  productId: ID
}

Interfaces

Node, ObjectWithMetadata

Fields

id

id · ID!

The unique ID of the product media.

privateMetadata

privateMetadata · [MetadataItem!]!

List of private metadata items. Requires staff permissions to access.

privateMetafield

privateMetafield · String

A single key from private metadata. Requires staff permissions to access.

Tip: Use GraphQL aliases to fetch multiple keys.

key

key · String!

privateMetafields

privateMetafields · Metadata

Private metadata. Requires staff permissions to access. Use keys to control which fields you want to include. The default is to include everything.

keys

keys · [String!]

metadata

metadata · [MetadataItem!]!

List of public metadata items. Can be accessed without permissions.

metafield

metafield · String

A single key from public metadata.

Tip: Use GraphQL aliases to fetch multiple keys.

key

key · String!

metafields

metafields · Metadata

Public metadata. Use keys to control which fields you want to include. The default is to include everything.

keys

keys · [String!]

sortOrder

sortOrder · Int

The sort order of the media.

alt

alt · String!

The alt text of the media.

translation

translation · ProductMediaTranslation

Returns translated product media fields for the given language code.

Added in Saleor 3.23

languageCode

languageCode · LanguageCodeEnum!

A language code to return the translation for product media.

Added in Saleor 3.23

type

type · ProductMediaType!

The type of the media.

oembedData

oembedData · JSONString!

The oEmbed data of the media.

url

url · String!

The URL of the media.

size

size · Int

Desired longest side the image in pixels. Defaults to 4096. Images are never cropped. Pass 0 to retrieve the original size (not recommended). Thumbnails are generated only in the available sizes: 32, 64, 128, 256, 512, 1024, 2048, 4096; sizeRounding determines which one is used.

sizeRounding

sizeRounding · ThumbnailSizeRoundingEnum

Determines how the requested size is matched to an available thumbnail size.

Added in Saleor 3.23

Default: NEAREST.

format

format · ThumbnailFormatEnum

The format of the image. When not provided, format of the original image will be used.

Default: ORIGINAL.

productId

productId · ID

Product id the media refers to.

Used by


Schema: Saleor 3.23.43. Download SDL.

Last updated on April 13, 2026

Was this page helpful?