How do I find all content that use a specific custom component?

All builder content entries save a dictionary in its meta of all the custom components used and a count of them:

meta: {
  componentsUsed: {
    ProductBox: 1,
    ProductCollectionGrid: 2
  }
}

So you can use Mongo-style queries to check for all content that has a specific component:

https://cdn.builder.io/api/v3/content/:modelName?apiKey={{your api key}}&query.meta.componentsUsed.{{ component name }}.$exists=true

Example: https://cdn.builder.io/api/v3/content/page?apiKey=303981477d1e41d08587796c8f3bf623&query.meta.componentsUsed.ProductCollectionGrid.$exists=true&fields=id,name,meta

3 Likes