HTTP Request Node Sends Number as String, Even When Using an Expression

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:

  1. Mode: Set the “Body Content Type” to JSON.

  2. Fixed Value: Initially, I set the duration parameter as a “Fixed” value of 10 (without quotes). Result: The sent request still contained "10" (a string).

  3. 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.

  4. 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".

Hey @meatsafe hope all is well, welcome to the community.

Try to use an expression, like {{ 10 }}, see if that helps.

Thanks for the tip!

I was also able to get it working by switching body content type to Raw, content type to application/json, and for the body I used:

{{ JSON.stringify({ “aspect_ratio”: “9:16”, “duration”: 10 }) }}