Get all categories through the API (including inactive)

Hello.

I was seeing this endpoint to get all categories (Get Category Tree) but testing, it doesn’t retrieve me all categories, it only include the active categories so… I wanted ask you: Do you have plans to implement an endpoint to get all categories including the inactive categories and filter using an “status” query param or something like this.

Thank you in advance.

1 Like

Unfortunately, we don’t have an endpoint that has the same behavior of Get Category Tree, but including inactive categories.

What you can do is loop through Get Category by ID, with a list of predefined IDs:

https://{{accountName}}.{{environment}}.com.br/api/catalog_system/pvt/category/{{categoryId}} 

This should be enough for most cases, since:

  • All category IDs are unique
  • New categories are created with sequential IDs (unless you explicitly specify their ID)

We don’t currently have plans to implement that feature, but could you elaborate on your use case? That way I can forward it to the product team so they are aware of your specific need.

Hello Geroge.

Thanks for your answer.

I’m working in a sync system between an internal system and VTEX so… when a category is created in the internal system I need to check if this category already exists in VTEX or not but I don’t have the id in VTEX, so… I need query all categories to check if this category exists on VTEX or not in order to get the ID on VTEX to update the internal system or in order to create this new category in the VTEX system.

But… at this moment the API give me only the active categories, my integration is creating duplicates for me because some categories exist in VTEX but are “inactive”.

Thank you in advance.

If the internal system is creating categories, I would recommend keeping a record of the correspondence in it.

You can check if a category with a specific ID exists by simply checking the result of Get Category by ID.

Also, you can try “scanning” a range of IDs in a loop with Get Category by ID to find all categories, active or inactive. But I wouldn’t recommend doing that on a recurring basis, just as a setup step to store correspondences within your internal system.