Skip to main content
Question

Import API - variant

  • August 14, 2025
  • 5 replies
  • 127 views

Drazen
Forum|alt.badge.img+2

Hi, 

we implemented an import service using the Import API and the system that uses it would send the “masterVariant” flag. 

When a product variant is initially created, we get NewMasterVariantAdditionNotAllowed error. 

https://docs.commercetools.com/api/import-export/import-resources#productvariantimport

I’m wondering how should we create the master variant then? Import without master variant flag and then run the import again to set the proper master variant? 

For me this is not very logical and friendly and gives the need for redundant operations (re-running the import with all attributes again)

 

Regards, 
Drazen

5 replies

Ben Hedrick
commercetooler
Forum|alt.badge.img
  • commercetooler
  • 16 replies
  • August 21, 2025

Drazen,

 

Thanks for reaching out.  We are reviewing this and will be back in touch with a suggestion.


  • Going Places
  • 2 replies
  • August 25, 2025

Hi Drazen,

Unfortunately, the API does not support this in a single request, and as a result, the Import API does not, either. However, the team is considering improving this.

We recommend that you use the following pattern when implementing the Import API.

  1. New product , imported using Product draft with all values being provided in the same batch and import request.

  2. Product updates have been handled by Products

  3. Variant addition and update handled by Product variants and Product variants patch.


This mitigates the issue mostly for new products; however, for existing products, you can run twice as you suggested (with all attributes) or have an application set new masters with the API directly after the import is complete.

Does that help?

Best Regards
Brian

For a quicker response, please use the Support portal for these types of questions.


Drazen
Forum|alt.badge.img+2
  • Author
  • Inspiring
  • 5 replies
  • August 29, 2025

Thank you for the answer, unfortunately this just confirmed my understanding/worries. 

As a general feedback would say that the Import API is not an ideal approach for importing data as it brings many blockers, edge cases and very high complexity where we need to have many checks/if/else cases when to do what, and my understanding of an Import API would be that it removes that complexity of the native Commercetools API a not that we need to handle al this cases and thinking when and how to handle it. 

Regards, 
Drazen


  • Going Places
  • 2 replies
  • August 29, 2025

Hi Drazen,

Thanks for the feedback. I have passed this on to the team.

If you have any more pain points, I would be interested in you sharing them here.

The team is constantly working to eliminate these blockers and edge cases and will seriously consider your feedback.

Best regards
Brian


Drazen
Forum|alt.badge.img+2
  • Author
  • Inspiring
  • 5 replies
  • August 29, 2025

With the current setup of Import SDK, I don’t see much value than just using the standard API and having control what we import. 

I would look at the Import API as a layer that removes the need to think about each CRUD operation, e.g. ideally we send some data and its either created or updated. 

ProductDraft → good only for initial load only, we also noticed some race conditions here when a source system sends multiple updates in very short time

Product Variant → kind makes sense so that you can import just one variant but again you need to use it in combination with ProductDraft as you can’t just import variants so again multiple different implementations wit different payloads, etc. 

Thank you, 
Regards