API support for deleting categories?

I am working with the API to build an integration with a Drupal site. One function I need to add is giving users the ability to delete a category, I see that it is not listed on the API documentation page here, but I did find this promising post that indicates that a PR with new functionality for this was merged. The PR didn’t indeivcate what the uri for the new functionality would be.

Wondering if anyone knows if this is available now and if so what uri I can use to access it?


The PR that you have linked to adds a delete_category method to the Discourse API gem. If you are using the Discourse API gem for your API calls, you will be able to use that method. If you are not using the Discourse API gem, you can delete a category through the API by making a DELETE request to your site’s /categories/<category_id> route. Set <category_id> to the id of the category you are wanting to delete.

I believe that either with the API gem, or with the DELETE request made to /categories/<category_id>, an error will be returned if the category has any topics in it other than the initial “About” topic that was created when you first created the category. You need to recategorize a category’s topics before deleting the category.


The better place to look is almost always How to reverse engineer the Discourse API.


Awesome, thank you both!

@simon thanks for the detailed reply, I see now that I was mistaking that repo for the discourse API repo.

This explanation is super helpful, thank you!