Remove all products from a custom collection with REST admin api

Topic summary

Removing all products from a custom (manual) collection via API and bulk updating its contents.

  • REST Admin API: Using PUT /custom_collections with “collects” adds products; sending an empty array (“collects”: ) does not remove existing products. There is no bulk remove via this approach.
  • Solution adopted: Admin GraphQL mutation collectionRemoveProducts, which removes products from a collection. It requires supplying the product IDs to be removed. This resolved the original request.
  • Key detail: You must enumerate product IDs; the API does not infer removals from an empty list.
  • Open question: Whether this method works only for manual collections and how to remove products from automatic collections. No answer provided; discussion remains open on that point.

Note: Code snippets demonstrating the REST payload were central to identifying the limitation and the switch to GraphQL.

Summarized with AI on January 5. AI used: gpt-5.

Hi Taylan,

It’s possible that it might be easier to use the collectionRemoveProducts mutation, which is part of the GraphQL API - however you’ll still need to provide product IDs. Would this work for you?

1 Like