# Automatic creation of space per group of users

**URL:** https://discuss.elastic.co/t/automatic-creation-of-space-per-group-of-users/174645
**Category:** Kibana
**Tags:** elastic-stack-security
**Created:** [March 30, 2019, 4:40pm UTC](https://discuss.elastic.co/t/automatic-creation-of-space-per-group-of-users/174645 "2019-03-30T16:40:09Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Amit\_Ripshtos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit_ripshtos/32/40400_2.png) [@Amit\_Ripshtos](https://discuss.elastic.co/u/Amit_Ripshtos)
#### Post date: [March 30, 2019, 4:40pm UTC](https://discuss.elastic.co/t/automatic-creation-of-space-per-group-of-users/174645/1 "2019-03-30T16:40:09Z")

</div>

Hey there,  
I'm trying to create a flow in my application that upon a new group in my application I will create a space, a security role with permissions to space and adjust the user permissions to have that role.

However, I thought maybe there is a more elegant way of doing so, maybe using the user's metadata to specify the allowed spaces (example: "my-space-{metadata.group\_name}"

Does anyone know if there is a good way of achieving that feature?  
Thanks,  
Amit.

---

<div class="post-metadata">

### Author: ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)
#### Post date: [April 2, 2019, 6:27pm UTC](https://discuss.elastic.co/t/automatic-creation-of-space-per-group-of-users/174645/2 "2019-04-02T18:27:07Z")

</div>

I think the best way to do this would be to use the Create Space API to create a new space when one is created in your application: [https://www.elastic.co/guide/en/kibana/current/spaces-api-post.html](https://www.elastic.co/guide/en/kibana/current/spaces-api-post.html)

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 30, 2019, 6:29pm UTC](https://discuss.elastic.co/t/automatic-creation-of-space-per-group-of-users/174645/3 "2019-04-30T18:29:07Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
