Generating unique slugs via the API and the need for external slugifier and API requests.

3 replies
Last updated: Jul 17, 2023
Hi everyone - another question that I hope you can help with 🙂Is it possible to generate a unique slug (making sure it’s unique) via the API using some out-of-the-box functionality, a library or plugin?
Or would I need to build/find an external slugifier, make an API request to check that it’s unique, and then a request to insert/update the document?
Jul 17, 2023, 6:20 PM
You’d need to go with the latter option 🙂
Jul 17, 2023, 7:21 PM
Thank you! 🙂
Jul 17, 2023, 7:22 PM
You’re welcome!
Jul 17, 2023, 7:23 PM

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?