# Check whether a category name is available. API dry-run / custom slug?

**URL:** <https://meta.discourse.org/t/check-whether-a-category-name-is-available-api-dry-run-custom-slug/90373>\
**Category:** Feature\
**Created:** [June 21, 2018, 7:46am UTC](https://meta.discourse.org/t/check-whether-a-category-name-is-available-api-dry-run-custom-slug/90373 "2018-06-21T07:46:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![ryancey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ryancey/32/99309_2.png) [@ryancey](https://meta.discourse.org/u/ryancey)\
**Post date:** [June 21, 2018, 7:46am UTC](https://meta.discourse.org/t/check-whether-a-category-name-is-available-api-dry-run-custom-slug/90373/1 "2018-06-21T07:46:59Z")

</div>

I’m facing an issue where I need to check wether creating a category with a given name is possible with the API — in other words, if a category slug is not already taken.

Right now, I check it by fetching `/c/foobar.json` and interpreting it (404 means available).

> User wants to create `Foobar` (slug `foobar`) → checking if `/c/foobar.json` already exists

But if the user wants to create `Foo Bar` (slug `foobar` too) it will raise an error because the slug already exists from another category (`Foobar`).

I’d need either:

- To **call an endpoint made for that** (e.g. `/category-available/name.json`) but I think it’s too specific.
- To **specify the slug as a parameter** of the category creation endpoint.
- To **dry-run the API category creation process**. This could be extended to other creation endpoints.

What do you guys think?

---

_[View the full topic](https://meta.discourse.org/t/check-whether-a-category-name-is-available-api-dry-run-custom-slug/90373)._
