# Got error "The bulk request must be terminated by a newline \[\\\\n\]" when importing data with curl and insomnia

**URL:** <https://discuss.elastic.co/t/got-error-the-bulk-request-must-be-terminated-by-a-newline-n-when-importing-data-with-curl-and-insomnia/326697>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [February 28, 2023, 5:00pm UTC](https://discuss.elastic.co/t/got-error-the-bulk-request-must-be-terminated-by-a-newline-n-when-importing-data-with-curl-and-insomnia/326697 "2023-02-28T17:00:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalimink](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kalimink/32/117866_2.png) [@Kalimink](https://discuss.elastic.co/u/Kalimink)\
**Post date:** [February 28, 2023, 5:00pm UTC](https://discuss.elastic.co/t/got-error-the-bulk-request-must-be-terminated-by-a-newline-n-when-importing-data-with-curl-and-insomnia/326697/1 "2023-02-28T17:00:52Z")

</div>

Hello,

after several attempts to integrate my data which are in json form via Curl and even insomnia

I always get the same error : "The bulk request must be terminated by a newline [\n]"

but even after adding a newline at the end of my file, I still get the error.

Does anyone have a clue how to fix this problem?

I specify that I use ELK 8.5.3 and that it is a Docker environment

Here is the Json that I use:

> **[JSON Blob | 1080172392478949376](https://jsonblob.com/1080172392478949376)**
>
> JSON Blob is a web-based tool to create, edit, view, format, and share JSON. It shows your JSON side by side in a clear, editable tree-view and in formatted plain text. You can save your JSON and share it via URL with anyone

Here is the command that i use :

```auto
curl -s -XPOST "http://localhost:9200/_bulk?pretty" -H "Content-Type: application/x-ndjson" --data-binary @test2.json

```

Thank you for your time and your help.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [February 28, 2023, 5:08pm UTC](https://discuss.elastic.co/t/got-error-the-bulk-request-must-be-terminated-by-a-newline-n-when-importing-data-with-curl-and-insomnia/326697/2 "2023-02-28T17:08:08Z")

</div>

That JSON file is not a valid bulk request payload. Have a look at [the docs](https://www.elastic.co/guide/en/elasticsearch/reference/8.6/docs-bulk.html) for an example of valid payload. If you are indexing a single document, do not use the bulk API.

---

<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:** [March 28, 2023, 5:08pm UTC](https://discuss.elastic.co/t/got-error-the-bulk-request-must-be-terminated-by-a-newline-n-when-importing-data-with-curl-and-insomnia/326697/3 "2023-03-28T17:08:17Z")

</div>

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