How to send HTTP Request form-data with content-typ application/json and application/xml

Describe the problem/error/question

I can’t send with http request form-data application-json.

Url API Docs: Portal de Atendimento ao Cliente - CENTRAL DE SOLUÇÕES

“Envio de XML”
4 - Clique na guia “Body”, marque a opção “FORM-DATA” e adicione as seguintes Keys:

  • file[] – Marque a opção File - application/xml;
  • query – Marque a opção Text - {“boxeFile”: false} - application/json;
  • fileComplement[] Marque a opção File

What is the error message (if any)?

With Form Urlencoded, i received this error:
HTTP 415 Unsupported Media Type

With Form Data:
HTTP 400 Bad Request

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://api.onvio.com.br/dominio/invoice/v3/batches”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “x-integration-key”,
“value”: “={{ $(‘Gerar a Key de Integração’).item.json.integrationKey }}”
},
{
“name”: “Authorization”,
“value”: “=Bearer {{ $(‘Token Bearer’).item.json.access_token }}”
}
]
},
“sendBody”: true,
“contentType”: “multipart-form-data”,
“bodyParameters”: {
“parameters”: [
{
“name”: “query”,
“value”: “{"boxeFile": false}”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-60,
-120
],
“id”: “898165e6-9871-4043-937e-a5ea4641e13e”,
“name”: “HTTP Request”
}
],
“connections”: {
“HTTP Request”: {
“main”: [

]
}
},
“pinData”: {}
}

Share the output returned by the last node

{
“errorMessage”: “The service was not able to process your request”,
“errorDescription”: “HTTP 400 Bad Request”,
“errorDetails”: {
“rawErrorMessage”: [
“500 - "{\"error\":{\"code\":500,\"errors\":,\"message\":\"HTTP 400 Bad Request\"}}"”
],
“httpCode”: “500”
},
“n8nDetails”: {
“nodeName”: “HTTP Request”,
“nodeType”: “n8n-nodes-base.httpRequest”,
“nodeVersion”: 4.2,
“itemIndex”: 0,
“time”: “04/02/2025, 08:21:16”,
“n8nVersion”: “1.70.3 (Self Hosted)”,
“binaryDataMode”: “default”,
“stackTrace”: [
“NodeApiError: The service was not able to process your request”,
" at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:525:33)“,
" at processTicksAndRejections (node:internal/process/task_queues:95:5)”,
" at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:732:19)“,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:716:51”,
" at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1147:20"
]
}
}

Information on your n8n setup

  • **n8n version:Version 1.70.3
  • **Database (default: SQLite):default
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):default
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • Operating system: Ubuntu 24.04 LTS (GNU/Linux 6.8.0-51-generic x86_64)