useCreateImageContent
The useCreateImageContent hook combines image upload with content creation to generate user-generated content entries. Built on top of useImageUpload, it extends the basic upload functionality with content management features including titles, descriptions, visibility controls, product associations, and unique IDs for sharing and discovery.
Anchor to ParametersParameters
The createImageContent function accepts an object with the following fields:
image(required): AFileobject representing the image to upload.contentTitle(required): The title for the content entry.visibility(optional): An array ofContentVisibilityvalues (see below).externalId(optional): A unique identifier from your own system that lets you look up content later viaContentWrapperusing an ID you already know. If not provided, the content can only be retrieved by itspublicId. EachexternalIdmust be unique per Mini — creating content with a duplicateexternalIdreturns aDUPLICATE_EXTERNAL_IDerror.description(optional): A text description for the content. Displayed alongside the content in Shop surfaces such as feeds and content detail views. Use this to provide context about the image, such as a caption or review text.productIds(optional): An array of Shopify product GIDs (e.g.'gid://shopify/Product/123') to associate with the content. Maximum 20 products. Associated products appear alongside the content, enabling shoppable content experiences. If any product IDs are ineligible, the mutation will return anINELIGIBLE_PRODUCTSerror.
Anchor to Visibility OptionsVisibility Options
The visibility parameter accepts an optional array of ContentVisibility values:
DISCOVERABLE: Makes content eligible for Shop's recommendation and discovery systems. Your content can appear in feeds and recommendations across the Shop app.LINKABLE: Enables shareable URLs for the content. When set, the createdContentobject includes ashareableUrlfield containing a URL that can be shared externally. The shareable page renders OpenGraph meta tags (og:title,og:image,og:description) using the content'scontentTitle, uploaded image, anddescription— so link previews in social media, messaging apps, and other platforms will display a rich card with the content's title, image, and description. Use theuseSharehook to trigger the native share sheet with this URL.
Anchor to Error HandlingError Handling
The hook may return userErrors in the response with the following codes:
DUPLICATE_EXTERNAL_ID: Returned when anexternalIdis provided that already exists for this Mini. EachexternalIdmust be unique per content entry.INELIGIBLE_PRODUCTS: Returned when one or moreproductIdsrefer to products that are not eligible for Shop. The error message includes the specific ineligible product GIDs.
Anchor to Use CasesUse Cases
- Shareable content with rich link previews: Include
LINKABLEin thevisibilityarray and provide acontentTitle,description, and image. The returnedshareableUrlpoints to a page with OpenGraph tags, so when shared via social media or messaging apps the link preview displays the content's title, image, and description as a rich card. Pass theshareableUrlto theuseSharehook to open the native share sheet. - User reviews with photos: Provide
descriptionfor the review text,productIdsto link the reviewed products, and['DISCOVERABLE', 'LINKABLE']visibility for maximum reach. - Shoppable lookbooks: Upload styled images with associated
productIdsso users can shop the look. - Content lookup by your own ID: Set
externalIdto an identifier from your system (e.g. a database row ID or slug) so you can retrieve the content later viaContentWrapperwithout storing thepublicId.
The hook handles both the image upload pipeline and content entity creation in a single operation, automatically associating content with your Mini and integrating with Shop's content systems.
You must run the setup CLI command before using this hook so the content can be associated with the Mini.
You must run the setup CLI command before using this hook so the content can be associated with the Mini.
Anchor to useCreateImageContentuse Create Image Content()
UseCreateImageContentReturns
- createImageContent
Upload an image and create content.
(params: CreateImageContentParams) => Promise<{ data: Content; userErrors?: ContentCreateUserErrors[]; }> - loading
Whether the content is being created.
boolean
CreateImageContentParams
- contentTitle
The title for the content entry.
string - description
A text description for the content. Displayed alongside the image in Shop surfaces such as feeds and content detail views. Use this to provide context about the image, such as a caption or review text.
string - externalId
A unique identifier from your own system that lets you look up content later via `ContentWrapper` using an ID you already know. If not provided, the content can only be retrieved by its `publicId`. Each `externalId` must be unique per Mini — creating content with a duplicate returns a `DUPLICATE_EXTERNAL_ID` error.
string - image
The image file to upload.
File - productIds
An array of Shopify product GIDs (e.g. `'gid://shopify/Product/123'`) to associate with the content. Maximum 20 products. Associated products appear alongside the content, enabling shoppable content experiences.
string[] - visibility
Visibility options for the content. Use `['DISCOVERABLE']` to appear in recommendations, `['LINKABLE']` to enable shareable URLs, or both. Pass `null` or `[]` to keep content private within your Mini.
ContentVisibility[] | null
ContentVisibility
'DISCOVERABLE' | 'LINKABLE'Content
- description
string | null - externalId
string | null - image
ContentImage - products
ContentProduct[] | null - publicId
string - shareableUrl
string | null - status
MinisContentStatus | null - title
string - visibility
ContentVisibility[]
ContentImage
- altText
string | null - height
number | null - id
string | null - thumbhash
string | null - url
string - width
number | null
ContentProduct
- featuredImage
ContentImage | null - id
string - title
string
MinisContentStatus
- PENDING
PENDING - READY
READY - REJECTED
REJECTED
ContentCreateUserErrors
- code
ContentCreateUserErrorCode - message
string
ContentCreateUserErrorCode
- DUPLICATE_EXTERNAL_ID
DUPLICATE_EXTERNAL_ID - INELIGIBLE_PRODUCTS
INELIGIBLE_PRODUCTS