# Kibana Internal API's via Python Request

**URL:** <https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073>\
**Category:** Kibana\
**Created:** [October 29, 2025, 12:45pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073 "2025-10-29T12:45:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![6igwig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6igwig/32/88971_2.png) [@6igwig](https://discuss.elastic.co/u/6igwig)\
**Post date:** [October 29, 2025, 12:45pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/1 "2025-10-29T12:45:40Z")

</div>

Is it possible to interact with Kibana's internal API's via Python? Do I need to add something to the header of the request besides `{'kbn-xsrf': 'true'}`

My specific use case is to be able to assign ML jobs to a specific space in Kibana:

```auto
POST /internal/ml/saved_objects/update_jobs_spaces

{
"jobIds": ["my_job"],
"jobType": "anomaly-detector",
"spacesToAdd":["test"],
"spacesToRemove":[]
}

```

This works perfectly from Dev Tools, but I need to run via GitLab CICD.

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [October 30, 2025, 5:07am UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/2 "2025-10-30T05:07:31Z")

</div>

Hello @6igwig

I believe via python we need to follow below documentation :

> **[Machine Learning (ML) — Python Elasticsearch client 9.0.2 documentation](https://elasticsearch-py.readthedocs.io/en/v9.0.2/api/ml.html)**

Thanks!!

---

<div class="post-metadata">

**Author:** ![6igwig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6igwig/32/88971_2.png) [@6igwig](https://discuss.elastic.co/u/6igwig)\
**Post date:** [October 30, 2025, 12:20pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/3 "2025-10-30T12:20:04Z")

</div>

Thanks Tortoise, but I don’t see any documentation related to internal API’s or setting/updating the space that a job is synced to.

---

<div class="post-metadata">

**Author:** ![Tortoise](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tortoise/32/147587_2.png) [@Tortoise](https://discuss.elastic.co/u/Tortoise)\
**Post date:** [October 30, 2025, 12:30pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/4 "2025-10-30T12:30:28Z")

</div>

Hello @6igwig

I see below enhancement request open on git :

> <https://github.com/elastic/kibana/issues/167744>
>
> \*\*Describe the feature:\*\*
> 
> It would be helpful to have a publicly documented A…PI available for assigning an ML job to a space. Currently this is only possible through the Kibana UI: https://www.elastic.co/guide/en/machine-learning/current/setup.html#kib-visibility-spaces
> 
> \*\*Describe a specific use case for the feature:\*\*
> Programatically creating ML jobs using the \[Elasticsearch ML API\](https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-apis.html) and then assigning them to a Kibana space.

Thanks!!

---

<div class="post-metadata">

**Author:** ![6igwig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6igwig/32/88971_2.png) [@6igwig](https://discuss.elastic.co/u/6igwig)\
**Post date:** [October 30, 2025, 12:43pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/5 "2025-10-30T12:43:10Z")

</div>

Thanks Tortoise, I’m aware of that issue and looking forward to it in v9.3 (mid January 2026). In the mean time, my question was about using Kibana’s internal API’s via Python.

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [October 30, 2025, 12:58pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/6 "2025-10-30T12:58:44Z")

</div>

From the discussion on the issue, I'm not sure you can.

This API is considered internal, so there is no public documentation on how it works.

My suggestion would be to ask on the Github Issue what is the workaround to use this API until it is made public so the devs may provide more insight.

---

<div class="post-metadata">

**Author:** ![6igwig](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/6igwig/32/88971_2.png) [@6igwig](https://discuss.elastic.co/u/6igwig)\
**Post date:** [October 30, 2025, 1:11pm UTC](https://discuss.elastic.co/t/kibana-internal-apis-via-python-request/383073/7 "2025-10-30T13:11:09Z")

</div>

Ok, thanks [Leandro](https://discuss.elastic.co/u/leandrojmp)!
