Hey, I want to use the HTTP node in n8n to access the model mistral-document-ai-2505.
This model is hosted and provided via Azure, and it uses different endpoints — you can only upload base64 strings.
So, I want to build a workflow that analyzes a document.
To do this, I use an “Execute Command” node to generate a base64 string from the file path.
This node works correctly and returns the following output:
[
{
"exitCode": 0,
"stderr": "",
"stdout": "JVBERi0xLjcNCiW1………tbW1DDAg"
}
]
Now, when I try to configure the HTTP node, I’m stuck.
The model expects me to send a JSON body that looks like this:
{
"model": "mistral-document-ai-2505",
"document": {
"type": "document_url",
"document_url": "data:application/pdf;base64,JVBERi0xLjcNCiW1………tbW1DDAg"
},
"include_image_base64": "true"
}
When I use a static request, the node works perfectly.
But since I want to process multiple documents, I need to use the Base64 string from the previous node.
For that, I insert the variable from the previous node input, which results in:
{
"model": "mistral-document-ai-2505",
"document": {
"type": "document_url",
"document_url": "data:application/pdf;base64,{{$json.stdout}}"
},
"include_image_base64": "true"
}
In the preview/output panel, the variable is correctly resolved — it shows the proper Base64 string, highlighted in green.
However, when I actually execute the node, I get the following error message:
“JSON parameter needs to be valid JSON”
I suspect the issue occurs during the variable substitution — something goes wrong when n8n converts the variable into JSON format.
Here’s how my HTTP node is configured:
-
“Send Body” is enabled
-
Body Content Type = JSON
-
The JSON code is in the “JSON” field
-
I use “Fixed” for the static version, and “Expression” for the dynamic one
I’d really appreciate any help or solution for this.
Thanks!
Node type: n8n-nodes-base.httpRequest
Node version: 4.2 (Latest)
n8n version: 1.109.2 (Self-hosted)
Stack trace:
NodeOperationError: JSON parameter needs to be valid JSON at ExecuteContext.execute



