Skip to main content

Product schema overview

The product schema is a standardized format that transforms your Shopify product data into an optimized structure for the search and browse engine.

Catalog scale and limits

Layers has no hard limits on the number of products, variants, or SKUs that can be synced and indexed. Layers scales with your catalog and has handled catalogs with millions of SKUs.

Schema fields

The following table outlines the key fields in the product schema, along with their data types, descriptions, and example values:
You can provide type-hints to Named Tags by using the {key}:{type}:{value} tag format. Supported types: number, boolean, and date.

Product media

Use media for images, Shopify-hosted videos, external videos, and 3D models in Shopify order. It is not returned by default: include media in attributes to get it. Requesting media does not also select images. The existing images field is unchanged. Each entry includes these fields: The remaining fields depend on type: preview is either an object containing src, width, and height, or null when no preview image is available. URLs, alt text, host, MIME types, and formats are strings; dimensions, video duration, and file size are numbers. Missing metadata is null, not an omitted key. Only media with Shopify status READY is included. Images without an image URL, videos and 3D models without sources, and external videos without an embed URL are skipped. The result is always a list, including [] when empty. For products that have not yet re-synced since media became available, media falls back to their existing images as IMAGE entries with id: null, position, alt, src, width, and height. Each product’s next sync replaces that fallback with its ready Shopify media; you do not need to change how you read images.

Selecting media

Use these selectors in attributes to return only the media you need: Indexes are zero-based, unlike the one-based position field. Type values are case-insensitive, so media[type=video] also works. Only type filters with IMAGE, VIDEO, EXTERNAL_VIDEO, or MODEL_3D are supported; another filter key or an unknown type returns a 400 invalid-field-selector error. The image fallback applies before filtering or slicing. For a product awaiting its next media sync, media[type=IMAGE] returns its fallback images and media[type=VIDEO] returns []. An out-of-range index or a filter with no matches also returns []; the product stays in the results.

King Linked Options groups

Enable King Linked Options and sync the catalog before using its product-card data. In search, browse, or block requests, include external.king_linked_options.group in attributes alongside the other fields your cards need. Read the group at results[].external.king_linked_options.group, not a top-level linked_options field. This follows the normal external-attribute projection: requesting the whole external object or using the default response also includes synced integration data. The group is an object or null; handle an absent integration or empty group without failing the rest of the product card. Validate that a handle and usable label exist before rendering a link. Use colors when present, otherwise the swatch image or a text fallback. Treat availability as synced display data, not a checkout guarantee. This integration does not merge sibling products into a single result or add swatch UI automatically. Layers refreshes eligible storefront-sourced integration data every six hours, in addition to product resyncs. Missing, inactive, deleted, or invalid groups replace stale group data with null; incomplete or failed sync responses keep the previous data. Disabling the integration removes its external attributes through normal integration cleanup.

API response type consistency

The following fields are guaranteed to always be returned as JSON objects (or null) in API responses, never as empty arrays. This keeps types consistent for API consumers and prevents type mismatches in strongly-typed clients:
  • metafields - Always an object or null
  • calculated - Always an object or null
  • named_tags - Always an object or null
  • category - Always an object or null
  • featured_media - Always an object or null
  • first_or_matched_variant - Always an object or null
  • price_range - Always an object or null
When these fields have no data, the API returns {} (empty object) or null, never [] (empty array). The API enforces this behavior at the response level to maintain consistent typing across all endpoints.
Sequential array fields like tags, images, and media are not affected by this enforcement and continue to return as arrays.

Data types and formatting

  • Integer: Whole numbers without decimals.
  • String: Textual data, often used for titles or descriptions.
  • Decimal: Numbers with decimal points, typically used for prices.
  • Array: A list of values, used for tags or features.
  • Boolean: A true or false value, indicating binary states such as availability.

See also