# Kibana spaces not able to create using api

**URL:** https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052
**Category:** Kibana
**Tags:** elastic-stack-security
**Created:** [April 1, 2020, 1:09pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052 "2020-04-01T13:09:42Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Masood\_Azam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masood_azam/32/48327_2.png) [@Masood\_Azam](https://discuss.elastic.co/u/Masood_Azam)
#### Post date: [April 1, 2020, 1:09pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/1 "2020-04-01T13:09:42Z")

</div>

Hello,

I am new to Kibana, I want to create spaces from web application.

I am able to get all spaces define in Kibana. But once I try to post it’s give me error.

Remote server not found 400 bad request. I am using the same web request to get it working fine. Once try to post it give me exception.

I am using proper username and password as define in Kibana.yml file.

Can anyone help me where I am doing mistake.

---

<div class="post-metadata">

### Author: ![Mike.Barretta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike.barretta/32/16688_2.png) [@Mike.Barretta](https://discuss.elastic.co/u/Mike.Barretta)
#### Post date: [April 1, 2020, 1:56pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/2 "2020-04-01T13:56:42Z")

</div>

@Masood_Azam, what does your API call look like, the one giving you the 400?

---

<div class="post-metadata">

### Author: ![Masood\_Azam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masood_azam/32/48327_2.png) [@Masood\_Azam](https://discuss.elastic.co/u/Masood_Azam)
#### Post date: [April 1, 2020, 6:07pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/3 "2020-04-01T18:07:02Z")

</div>

Hello Mike,  
Thanks for reply, I am create a web application using mvc .net.

I am using http web request to call the kibana rest api.

As i mention, once i called using http web request with method GET i get all the spaces define in Kibana.  
GET /api/spaces/space/marketing

but once in try to POST i get exception!  
POST /api/spaces/space

---

<div class="post-metadata">

### Author: ![Mike.Barretta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike.barretta/32/16688_2.png) [@Mike.Barretta](https://discuss.elastic.co/u/Mike.Barretta)
#### Post date: [April 1, 2020, 6:22pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/4 "2020-04-01T18:22:56Z")

</div>

@Masood_Azam It's more helpful to post actual code vs a photo of code.

It's still not clear what you are trying to post (adding a user to space?), but [the Kibana Spaces APi docs](https://www.elastic.co/guide/en/kibana/current/spaces-api.html) walk through all your options.

If you are trying to create a space, you must pass an `id` and `name` like:

```auto
curl -X POST "localhost:5601/api/spaces/space"
{
  "id": "awesome-space",
  "name": "Awesome Space"
}

```

If you're trying to setup permissions for spaces, you want the [Kibana role management API](https://www.elastic.co/guide/en/kibana/current/role-management-api-put.html)

---

<div class="post-metadata">

### Author: ![Masood\_Azam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masood_azam/32/48327_2.png) [@Masood\_Azam](https://discuss.elastic.co/u/Masood_Azam)
#### Post date: [April 1, 2020, 7:24pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/5 "2020-04-01T19:24:50Z")

</div>

Hello Mike,

I want to create new space in Kibana.

---

<div class="post-metadata">

### Author: ![Mike.Barretta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike.barretta/32/16688_2.png) [@Mike.Barretta](https://discuss.elastic.co/u/Mike.Barretta)
#### Post date: [April 1, 2020, 7:46pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/6 "2020-04-01T19:46:45Z")

</div>

Looks reasonable: if you write out the value of `PostJson` does it look like:

```auto
{
  "id": "TestSpace",
  "name": "TestSpace",
  "description": "TestSpace"
}

```

without any other values? ...not sure what `OrganizationRootObject` would output

---

<div class="post-metadata">

### Author: ![Masood\_Azam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masood_azam/32/48327_2.png) [@Masood\_Azam](https://discuss.elastic.co/u/Masood_Azam)
#### Post date: [April 2, 2020, 5:12am UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/7 "2020-04-02T05:12:54Z")

</div>

Hello Mike,  
I also try to make Post Json like this "{"id": "TestSpace"}"; or "{id:TestSpace}"; it still give me same result ☹

---

<div class="post-metadata">

### Author: ![Masood\_Azam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/masood_azam/32/48327_2.png) [@Masood\_Azam](https://discuss.elastic.co/u/Masood_Azam)
#### Post date: [April 2, 2020, 9:09am UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/8 "2020-04-02T09:09:06Z")

</div>

Hello Mike,

Its ok, working now there is issue in disabledFeature ☹

---

<div class="post-metadata">

### Author: ![Mike.Barretta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mike.barretta/32/16688_2.png) [@Mike.Barretta](https://discuss.elastic.co/u/Mike.Barretta)
#### Post date: [April 2, 2020, 2:33pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/9 "2020-04-02T14:33:28Z")

</div>

As before, you need to share the specific calls you're making to the API. Can you share the request body containing the `disabledFeatures` array? Are you sure the IDs are valid, having come from the [features API](https://www.elastic.co/guide/en/kibana/current/features-api-get.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, 2020, 2:33pm UTC](https://discuss.elastic.co/t/kibana-spaces-not-able-to-create-using-api/226052/10 "2020-04-30T14:33:29Z")

</div>

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