Fixing Bad Request Errors: Sending a Single Variable as JSON in HTTP Requests
Malformed JSON or incorrect content-type headers are the most common causes of 'Bad request - please check your parameters' when sending a single variable. Developers should ensure the payload is serialized, headers match the format, and the API contract is respected.
Root cause and symptom. The described workflow sends the body as a raw string pointing at a single variable. Common failures are missing JSON serialization, incorrect content-type header, or mismatched shapes expected by the receiving API. 'Bad request' typically indicates the server received payload it could not parse or a required field was absent.
Technical fixes and best practices. Ensure the request body is valid JSON by serializing the variable rather than embedding its reference as raw text. For example, convert the variable to a JSON string before sending, and set Content-Type to application/json. If the platform supports expressions, use a serialization helper or wrap the payload in a well-formed JSON object with explicit keys. Validate against the API schema locally (using a small test client or curl) to confirm the expected structure.
What leaders should mandate. Require API contract validation and automated tests for integration workflows, log both outgoing payloads and server responses for rapid debugging, and adopt schema-based validation at the ingress. These practices reduce operational outages, improve developer productivity, and prevent simple parameter errors from cascading into production incidents.
Original Source
n8n Community
