HTTP Request Node : Your request is invalid or could not be processed by the service

I’m a newbie to n8n and was trying to connect an HTTP Request Node with Tavily API and with right token, but on executing the step, I’m getting the following error.

Here’s the JSON for the node as well. The HTTP Form Requests gives the error code 422, which suggests there might be some semantic issue. So I tried validating the JSON with a parser, but the issue persists!

I’m planning to use data from a Google sheet to be sent as the parameter, but the node fails on the simple request itself.

{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://api.tavily.com/search”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Authorization”,
“value”: “Bearer ”
}
]
},
“sendBody”: true,
“specifyBody”: “json”,
“jsonBody”: “={\n "query": "who is Leo Messi?",\n "topic": "general",\n "search_depth": "basic",\n "chunks_per_source": 3,\n "max_results": 1,\n "time_range": null,\n "days": 7,\n "include_answer": true,\n "include_raw_content": true,\n "include_images": false,\n "include_image_descriptions": false,\n "include_domains": ,\n "exclude_domains": ,\n "country": null\n}”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
440,
240
],
“id”: “206438d0-e5a4-40dc-a9b5-8dd148134028”,
“name”: “HTTP Request”
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “69d9903ab2c9d8e704c210d72b2ee42032417b8d35f25afe2662e04b120767f5”
}
}

Their example payload has some issue

{
  "query": "who is Leo Messi?",
  "topic": "general",
  "search_depth": "basic",
  "chunks_per_source": 3,
  "max_results": 1,
  "time_range": null,
  "days": 7,
  "include_answer": true,
  "include_raw_content": true,
  "include_images": false,
  "include_image_descriptions": false,
  "include_domains": [],
  "exclude_domains": [],
  "country": null
}

Change the payload to this will work.

The error suggest the payload is not valid. So they can not process the request.


Please do not paste the api key next time here. It will have leak issue.

You should go back to Tavily to regenate the api key as soon as possible

1 Like

Thanks Darrell! The payload you gave worked! Was the issue because of the line breaks in json? I couldn’t figure out what’s the main difference between your payload and the one i added.

And thanks for the api key reminder, I’ve updated it as well! :+1:t3:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.