Http request custom headers with raw data

Hi all,
I’m completly stuck.
I’m trying to make a post to an old API.
This API needs a POST, with a raw body in XML and custom headers such as api-key

I got this error and have no clue what to do .
Thanks for your help

Welcome to the community @Jerome_Laurens!

It looks like you want to do something like this:
(you can copy the following JSON and then paste directly into n8n)

  "nodes": [
      "parameters": {
        "requestMethod": "POST",
        "url": "",
        "responseFormat": "string",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "raw",
          "bodyContentCustomMimeType": "text/xml"
        "bodyParametersJson": "whatever",
        "headerParametersJson": "={{ {\"api-key\": \"xxxx\"} }}"
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
  "connections": {}

Great @jan ! it works, the only difference with my previous tries was that the header field is an expression and not a value.
DO you know why that’s changing something ?

Another question : how do you export this json ?

That is changing something because the content-type which got also set, gets added to that header. If that header is a string and not an object (what it is, if you set it as an expression) it can not add that content-type and so it fails.

What do you mean with “this json”? The node? Simply select the nodes you want to export and then copy (ctrl + c). You are then able to paste it anywhere you want with ctrl + c.

Crystal clear Jan, thank you.
And yes, I just wanted to export/import the json like the one you sent me.

Thanks again

Perfect. You are welcome, have fun!