# Error uploading ndjson files to /api/saved\_objects/\_import : returned 406

**URL:** <https://discuss.elastic.co/t/error-uploading-ndjson-files-to-api-saved-objects-import-returned-406/289618>\
**Category:** Kibana\
**Created:** [November 18, 2021, 3:50pm UTC](https://discuss.elastic.co/t/error-uploading-ndjson-files-to-api-saved-objects-import-returned-406/289618 "2021-11-18T15:50:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![lokeshv1989](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@lokeshv1989](https://discuss.elastic.co/u/lokeshv1989)\
**Post date:** [November 18, 2021, 3:50pm UTC](https://discuss.elastic.co/t/error-uploading-ndjson-files-to-api-saved-objects-import-returned-406/289618/1 "2021-11-18T15:50:39Z")

</div>

Hi, we are trying to build powershell script to import the ndjson (Diskutilization.ndjson) file into Kibana.

$upload\_object = $es\_url + “/api/saved\_objects/\_import?overwrite=true”

$form = @{  
file = Get-Content -Raw -Path “Diskutilization.ndjson”  
minorEdit = “true”  
}

Invoke-WebRequest -UseBasicParsing -Uri $upload\_object -Credential $credentials -Method ‘POST’ -Headers @{  
‘Content-Type’ = ‘multipart/form-data’  
‘kbn-xsrf’ = ‘true’  
‘securitytenant’ = ‘Observability’  
} -Form $form -WebSession $websession

We are getting the below error,

{“error”:“Content-Type header [multipart/form-data; boundary=“ad6f415c-0f94-4ba4-99f0-bca0132967a1”] is not supported”,“status”:406}

We also tried ‘Content-Type’ = ‘application/json’. it did not work either. same error.

Not able to resolve this, can you please help.

Regards  
Lokesh V

---

<div class="post-metadata">

**Author:** ![brianseeders](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brianseeders/32/84831_2.png) [@brianseeders](https://discuss.elastic.co/u/brianseeders)\
**Post date:** [November 22, 2021, 8:06pm UTC](https://discuss.elastic.co/t/error-uploading-ndjson-files-to-api-saved-objects-import-returned-406/289618/2 "2021-11-22T20:06:03Z")

</div>

Hey @lokeshv1989,

Can you try removing the `‘Content-Type’ = ‘multipart/form-data’` header altogether? You might also try `Content-Type: application/x-ndjson`, but I think you will have better luck if you just omit it entirely.

Thanks  
Brian

---

<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:** [December 20, 2021, 8:06pm UTC](https://discuss.elastic.co/t/error-uploading-ndjson-files-to-api-saved-objects-import-returned-406/289618/3 "2021-12-20T20:06:18Z")

</div>

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