# The get api for kibana spaces doesn't seem to work for python script

**URL:** <https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872>\
**Category:** Kibana\
**Created:** [March 16, 2023, 5:47pm UTC](https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872 "2023-03-16T17:47:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhrugu\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhrugu_sharma/32/116623_2.png) [@Bhrugu\_Sharma](https://discuss.elastic.co/u/Bhrugu_Sharma)\
**Post date:** [March 16, 2023, 5:47pm UTC](https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872/1 "2023-03-16T17:47:32Z")

</div>

i need to get the spaces from my kibana and i am writing my python code for that

```auto
import requests

response = requests.get('https://<correct ELASTICSEARCH URL>:443/api/spaces/space', auth=HTTPBasicAuth('elastic', 'CORRECT PASSWORD'))
response.json()

```

i get this response

 ![tempsnip](https://us1.discourse-cdn.com/elastic/original/3X/9/7/972de87237e5b7898e24367950673c6563c8a9b7.jpeg)  
but according to the documentation [here](https://www.elastic.co/guide/en/kibana/current/spaces-api-get-all.html#spaces-api-get-all-example-1) it should work.  
so i can't understand what seems to be the issue.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 16, 2023, 6:18pm UTC](https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872/2 "2023-03-16T18:18:36Z")

</div>

Spaces are not part of the Elasticsearch API you will need to hit the [Kibana API.](https://www.elastic.co/guide/en/kibana/master/spaces-api-get-all.html)

The Elastic Python client does not directly interact with Kibana as fair as I know, so you will need to use the Kibana API and Kibana Endpoint via an HTTP request like above but against Kibana

> [@Bhrugu\_Sharma](#):
>
> but according to the documentation [here](https://www.elastic.co/guide/en/kibana/current/spaces-api-get-all.html#spaces-api-get-all-example-1) it should work.  
> so i can't understand what seems to be the issue.

Right but against the Kiabana endpoint per the docs you reference, not the elasticsearch endpoint

`GET <kibana host>:<port>/api/spaces/space`

---

<div class="post-metadata">

**Author:** ![Bhrugu\_Sharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhrugu_sharma/32/116623_2.png) [@Bhrugu\_Sharma](https://discuss.elastic.co/u/Bhrugu_Sharma)\
**Post date:** [March 16, 2023, 6:38pm UTC](https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872/3 "2023-03-16T18:38:33Z")

</div>

Thank you it worked as soon as i replaced it with kibana endpoint

---

<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 13, 2023, 6:38pm UTC](https://discuss.elastic.co/t/the-get-api-for-kibana-spaces-doesnt-seem-to-work-for-python-script/327872/4 "2023-04-13T18:38:38Z")

</div>

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