# How to export and Import Indexes and searches for Kibana using API?

**URL:** https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018
**Category:** Kibana
**Created:** [June 28, 2019, 10:01am UTC](https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018 "2019-06-28T10:01:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![shriharsha](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@shriharsha](https://discuss.elastic.co/u/shriharsha)
#### Post date: [June 28, 2019, 10:01am UTC](https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018/1 "2019-06-28T10:01:33Z")

</div>

I want to export and Import Kibana Indexes and Searches in to a json file using APIs.  
Can we do that?  
If so, how?

---

<div class="post-metadata">

### Author: ![Catherine\_Liu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/catherine_liu/32/34294_2.png) [@Catherine\_Liu](https://discuss.elastic.co/u/Catherine_Liu)
#### Post date: [June 28, 2019, 9:49pm UTC](https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018/2 "2019-06-28T21:49:07Z")

</div>

You can use the Saved Objects API to export/import index patterns and saved searches, which are both Kibana Saved Objects. See [Export Objects](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-export.html) and [Import Objects](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-import.html).

---

<div class="post-metadata">

### Author: ![shriharsha](https://avatars.discourse-cdn.com/v4/letter/s/7cd45c/32.png) [@shriharsha](https://discuss.elastic.co/u/shriharsha)
#### Post date: [July 1, 2019, 10:47am UTC](https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018/3 "2019-07-01T10:47:09Z")

</div>

Thanks for the response Catherine.  
But I am trying to call this API:  
curl -X POST "[http://localhost:5601/api/saved\_objects/\_export](http://localhost:5601/api/saved_objects/_export)" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'  
{  
"objects": [  
{  
"type": "index-pattern",  
"id": "4afc1210-cb86-11e8-a511-856ad0f7e2c7"  
}  
]  
}  
'  
And I am getting following error:  
`{"statusCode":400,"error":"Bad Request","message":"child \"attributes\" fails because [\"attributes\" is required]. \"objects\" is not allowed","validation":{"source":"payload","keys":["attributes","objects"]}}`

I don't know what is wrong in the API call I called.  
Can you help me. Please

---

<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: [July 29, 2019, 10:47am UTC](https://discuss.elastic.co/t/how-to-export-and-import-indexes-and-searches-for-kibana-using-api/188018/4 "2019-07-29T10:47:20Z")

</div>

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