# How to get and post kibana spaces by api call?

**URL:** <https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684>\
**Category:** Kibana\
**Created:** [July 1, 2022, 6:20pm UTC](https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684 "2022-07-01T18:20:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Vasconcelos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gabriel_vasconcelos/32/101942_2.png) [@Gabriel\_Vasconcelos](https://discuss.elastic.co/u/Gabriel_Vasconcelos)\
**Post date:** [July 1, 2022, 6:20pm UTC](https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684/1 "2022-07-01T18:20:03Z")

</div>

Hello everyone, I would like to know how I can return kibana spaces via api, I tried from the documentation: [Kibana spaces APIs | Kibana Guide [8.3] | Elastic](https://www.elastic.co/guide/en/kibana/current/spaces-api.html), but when I give a get , I don't get the default spaces and stuff I created. When I enter dev tools and use the POST command :/api/spaces/space kibana just creates this space with an index api, but this space is also not shown via get. I would like to know some method to return the default spaces of kibana through dev tools. I would like to know how to create and query the spaces that are shown in the kibana graphical interface when I access the path "/management/kibana/spaces".

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [July 14, 2022, 9:37pm UTC](https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684/2 "2022-07-14T21:37:50Z")

</div>

Hi Gabriel,  
Sorry you didn't get any response sooner. Maybe you already solved it?

The Kibana Dev Tools console only connects to Elasticsearch and the Spaces API is a Kibana API so you can't use the Dev Tools for it. In the example below, I had first created a space named "testSpace" in Kibana. Then I use curl to get the spaces. I have security enabled and included my username:password in the URL, but you can also use `-u` argument to curl.  
I piped it through jq just for formatting but that's optional. This should get you on your way to creating spaces as well. Post again if you get stuck.

Regards,  
Lee

```auto
main/kibana - (main) > curl -XGET https://elastic:changeit@localhost:5601/api/spaces/space | jq
  % Total % Received % Xferd Average Speed Time Time Time Current
                                 Dload Upload Total Spent Left Speed
100 243 100 243 0 0 8002 0 --:--:-- --:--:-- --:--:-- 11571
[
  {
    "id": "default",
    "_reserved": true,
    "color": "#00bfb3",
    "description": "This is your default space!",
    "disabledFeatures": [],
    "name": "Default"
  },
  {
    "id": "testspace",
    "name": "testSpace",
    "initials": "t",
    "color": "#B9A888",
    "disabledFeatures": [],
    "imageUrl": ""
  }
]

```

---

<div class="post-metadata">

**Author:** ![LeeDr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leedr/32/9289_2.png) [@LeeDr](https://discuss.elastic.co/u/LeeDr)\
**Post date:** [July 14, 2022, 9:40pm UTC](https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684/3 "2022-07-14T21:40:21Z")

</div>

Update: In 8.3 release of Kibana you actually CAN use the Dev Tools console! You just add the `kbn:`

`GET kbn:/api/spaces/space`

```auto
[
  {
    "id": "default",
    "_reserved": true,
    "color": "#00bfb3",
    "description": "This is your default space!",
    "disabledFeatures": [],
    "name": "Default"
  },
  {
    "id": "testspace",
    "name": "testSpace",
    "initials": "t",
    "color": "#B9A888",
    "disabledFeatures": [],
    "imageUrl": ""
  }
]

```

---

<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:** [August 11, 2022, 9:40pm UTC](https://discuss.elastic.co/t/how-to-get-and-post-kibana-spaces-by-api-call/308684/4 "2022-08-11T21:40:58Z")

</div>

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