# Is there a Saved Objects API in Opensearch?

**URL:** https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625
**Category:** OpenSearch
**Created:** [July 31, 2024, 1:26pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625 "2024-07-31T13:26:38Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![curlquest](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@curlquest](https://forum.opensearch.org/u/curlquest)
#### Post date: [July 31, 2024, 1:26pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/1 "2024-07-31T13:26:38Z")

</div>

Elasticsearch has a Saved Objects API and it is in their documentation, but I can’t find it in the Opensearch documentation. I’ve tried the “curl -XPOST -k http:// localhost:5601/api/saved\_objects/\_export” kind of commands but it does not work. Has it been deprecated? If not, how do I access it?

---

<div class="post-metadata">

### Author: ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/9946_2.png) [@pablo](https://forum.opensearch.org/u/pablo)
#### Post date: [July 31, 2024, 9:38pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/2 "2024-07-31T21:38:15Z")

</div>

@curlquest This worked for me with OpenSearch Dashboards 2.15.0

```auto
curl --insecure -X POST "https://localhost:5601/api/saved_objects/_export" -H "osd-xsrf: true" -H "Content-Type: application/json" -u admin:Eliatra123 -d'
{
  "type": ["index-pattern", "search", "visualization", "dashboard"]
}'

```

---

<div class="post-metadata">

### Author: ![curlquest](https://avatars.discourse-cdn.com/v4/letter/c/22d042/32.png) [@curlquest](https://forum.opensearch.org/u/curlquest)
#### Post date: [August 1, 2024, 1:05pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/3 "2024-08-01T13:05:17Z")

</div>

I’m getting “{“error”:“no handler found for uri [/api/saved\_objects/\_export] and method [POST]”}” as a response. I wonder if I don’t have something installed? It’s an Opensearch instance made from AWS.

---

<div class="post-metadata">

### Author: ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/9946_2.png) [@pablo](https://forum.opensearch.org/u/pablo)
#### Post date: [August 1, 2024, 1:39pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/4 "2024-08-01T13:39:19Z")

</div>

@curlquest I’ve tested against standalone OpenSearch Dashboards deployment. If you have issues with managed AWS service then you should contact their support.

---

<div class="post-metadata">

### Author: ![Iqra\_shafiq](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@Iqra\_shafiq](https://forum.opensearch.org/u/Iqra_shafiq)
#### Post date: [October 18, 2024, 11:13am UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/5 "2024-10-18T11:13:30Z")

</div>

I executed following command but I was able to export only 4 objects. However there were 56 objects in total when I made the request via browser

```auto
curl --insecure -X POST "https://192.168.0.81:5601/api/saved_objects/_export" -H "osd-xsrf: true" -H "Content-Type: application/json" -u admin:opensearch -d'
{
  "type": "index-pattern"
}' 

```

How to resolve it to fetch all the saved objects. I have basically 56 index patterns saved and I want to export them

---

<div class="post-metadata">

### Author: ![pablo](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/pablo/32/9946_2.png) [@pablo](https://forum.opensearch.org/u/pablo)
#### Post date: [October 22, 2024, 9:33pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/6 "2024-10-22T21:33:04Z")

</div>

@Iqra_shafiq Do you mean 56 index pattern objects?

---

<div class="post-metadata">

### Author: ![Iqra\_shafiq](https://avatars.discourse-cdn.com/v4/letter/i/d2c977/32.png) [@Iqra\_shafiq](https://forum.opensearch.org/u/Iqra_shafiq)
#### Post date: [December 3, 2024, 5:02am UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/7 "2024-12-03T05:02:56Z")

</div>

yes

---

<div class="post-metadata">

### Author: ![farhadson](https://avatars.discourse-cdn.com/v4/letter/f/b782af/32.png) [@farhadson](https://forum.opensearch.org/u/farhadson)
#### Post date: [May 13, 2025, 12:52pm UTC](https://forum.opensearch.org/t/is-there-a-saved-objects-api-in-opensearch/20625/8 "2025-05-13T12:52:40Z")

</div>

I thinks it’s all about in which tenant you call this api, previously I followed another post in forum and come with this. sorry that I can’t mention them its been a while, it works with my v2.8 and maybe there is a better api for it in newer versions but check this out:

```auto
export user=
export pass=
export url_dashboard_socket=
export tenant=
export export_path=

mkdir -p $export_path
echo ""
echo "1 - save cookie"
echo ""

curl --header 'Content-Type: application/json' \
 --header 'osd-xsrf: true' \
 --cookie-jar ${export_path}/opensearch_dashboards-cookies.txt \
 --user "${user}:${pass}" --insecure --location --request POST "${url_dashboard_socket}/auth/login" \
 --data-raw "
 {
    \"username\":\"${user}\",\"password\":\"${pass}\"
 }"

echo ""
echo "2 - view account based on saved cookie"
echo ""

curl --header 'Content-Type: application/json' \
 --header 'osd-xsrf: true' \
 --cookie ${export_path}/opensearch_dashboards-cookies.txt \
 --user "${user}:${pass}" --insecure --location --request GET "${url_dashboard_socket}/api/v1/configuration/account" \
 | jq .

echo ""
echo "2 - change tenant"
echo ""

curl --header 'Content-Type: application/json' \
 --header 'osd-xsrf: true' \
 --cookie ${export_path}/opensearch_dashboards-cookies.txt \
 --cookie-jar ${export_path}/opensearch_dashboards-cookies.txt \
 --user "${user}:${pass}" --insecure --location --request POST "${url_dashboard_socket}/api/v1/multitenancy/tenant" \
 --data-raw "
 {
    \"tenant\": \"${tenant}\", \"username\": \"${user}\"
 }"

echo ""
echo "echo 2 - view account based on saved cookie after changing tenant"
echo ""

curl --header 'Content-Type: application/json' \
 --header 'osd-xsrf: true' \
 --cookie ${export_path}/opensearch_dashboards-cookies.txt \
 --user "${user}:${pass}" --insecure --location --request GET "${url_dashboard_socket}/api/v1/configuration/account" \
 | jq .

echo ""
echo "3- get all saved objects"
echo ""
curl --header 'Content-Type: application/json' \
 --header 'osd-xsrf: true' \
  --cookie ${export_path}/opensearch_dashboards-cookies.txt \
  -u ${user}:${pass} \
 --insecure --location --request POST "${url_dashboard_socket}/api/saved_objects/_export" \
 -d '{
    "type": ["index-pattern", "search", "visualization", "visualization-visbuilder", "dashboard", "url", "query", "config", "map"]
  }' | tee -a "${export_path}/all_saved_object.ndjson"
```
