Product API to link existing picture to product

Topic summary

A user has manually uploaded product images to Shopify and is attempting to link them to products via API.

The core issue: When using the media object with a URL (in both REST and GraphQL APIs), Shopify creates duplicate images instead of reusing existing ones.

Key observations:

  • Manual linking through the Shopify admin interface works as expected
  • No working API solution has been found yet to reference already-uploaded images

The question remains open: Is there a method to programmatically link existing images to products without creating duplicates?

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

I have manually uploaded all product pictures to shopify and now trying to link them to products using API.

I haven’t found a working solution neither for REST to GRAPHQL how to resuse exactly the same picture.

media object requires ulr and providing it, shopify each time creates a new picture.

BTW, it works manually via admin.

Is there any way to link existing pictures to shopify products using API?