I’ve encountered a persistent issue where the HTTP Request node is incorrectly sending a numerical value as a string in the JSON body. I believe this may be a bug. The error message I am getting is:
My Goal: I am trying to send a JSON payload to an API that requires one of its fields, duration
, to be an integer (e.g., "duration": 10
).
My n8n Version: 1.98.2 (Cloud)
The Problem: No matter how I configure the node, the final request body always contains "duration": "10"
(a string), which causes the API to return a 400 Bad Request
error.
Here is everything I have tried to fix this:
-
Mode: Set the “Body Content Type” to
JSON
. -
Fixed Value: Initially, I set the
duration
parameter as a “Fixed” value of10
(without quotes). Result: The sent request still contained"10"
(a string). -
Expression Value: I then changed the parameter to be an “Expression” and set the value to
{{ 10 }}
. Result: The sent request still contained"10"
(a string), which is very unexpected. -
Schema Option: We attempted to use the “Schema” option in the HTTP node to enforce the data type, but this option is not available in my n8n version’s UI.
I have confirmed via the “Request” object in the error details that the value is being stringified every time, despite the input in the n8n UI being a proper number.
Here is a screenshot showing the node configured to send duration
as an Expression with the value 10
, and the resulting request body where it is incorrectly sent as "10"
.