Create Product with raw jpeg Images using graphiQL

Topic summary

A developer is attempting to upload JPEG images when creating or updating products via GraphQL mutations (productCreate and productUpdate). The challenge is that the media input only accepts image URLs, not raw base64-encoded images or direct file uploads.

Solution provided:

  • Use the stagedUploadsCreate mutation to first upload the image file
  • Obtain a staged upload URL from this mutation
  • Pass this URL to the media argument (specifically CreateMediaInput.originalSource) in the productCreate mutation
  • The media field requires type CreateMediaInput with properties like mediaContentType: IMAGE and originalSource

Process overview:

  1. Stage the upload using stagedUploadsCreate
  2. Upload the file to the staged URL
  3. Reference the staged URL in productCreate/productUpdate
  4. Complete the product creation

A participant notes this 4-step process is complex and suggests creating documentation to simplify it, contrasting it with the REST API which allows direct image uploads in a single step.

Summarized with AI on November 24. AI used: claude-sonnet-4-5-20250929.

This is a common problem, considering this has 4 steps process, may be a single page wiki will be useful.

Rest API allows you to create products with images ( raw or URL)in a single step.