# Set default index automatically in new spaces

**URL:** <https://discuss.elastic.co/t/set-default-index-automatically-in-new-spaces/178152>\
**Category:** Kibana\
**Created:** [April 24, 2019, 5:13am UTC](https://discuss.elastic.co/t/set-default-index-automatically-in-new-spaces/178152 "2019-04-24T05:13:05Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [April 24, 2019, 1:45pm UTC](https://discuss.elastic.co/t/set-default-index-automatically-in-new-spaces/178152/2 "2019-04-24T13:45:09Z")

</div>

Hey @Steven_Ensslen,

To set the default index pattern for a new space, you can prefix the API call with the space identifier. For example, if you are setting this for the "Marketing" space with a Space Identifier of `marketing`, then your API call would look something like:

`POST /s/marketing/api/kibana/settings/defaultIndex`

```auto
{
   "value": "indexPatternGUID"
}

```

If you were to inspect your `.kibana` index, this would set the default index pattern for the `marketing` space to the index pattern with the document id `marketing:index-pattern:indexPatternGUID`.

A couple of notes:

- This will not create the index pattern; it only tells Kibana which index pattern should be the default for that particular space.
- The API endpoint to set the default index pattern is not a publicly documented API, so it can potentially change unexpectedly between versions.
- We recognize the docs for calling APIs within a particular space are lacking. We have a few open issues to improve the documentation, including [https://github.com/elastic/kibana/issues/29646](https://github.com/elastic/kibana/issues/29646)

---

_[View the full topic](https://discuss.elastic.co/t/set-default-index-automatically-in-new-spaces/178152)._
