AzureTranslator HTTP Request return The body of the request is not valid JSON

ReMiKU 6 Reputation points

Hello I'm new to MS Azure and have been trying to use the translator resource with n8n

Using the HTTP Request node I've been trying out all settings available but I don't think the settings or parameters are wrong since I tried posting a request to and all the parameters passed successfully


But when I try it on the azure API it failed


I'm not sure if this is a correct method but I also tried to use Azure Active Directory? To then use the resource by connecting the account? but that aswell gave me an error using n8n OAuth2


I've been stuck for days on this issue and I've scoured through forums but to no avail, please help :'( thanks in advance!

Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
338 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. YutongTie-MSFT 45,911 Reputation points


    Thanks for reaching out to us here. Seems like the way you are passing your request is not correct, please check below code sample which I just tested and worked.

     import requests, uuid, json  
     # Add your subscription key and endpoint  
     subscription_key = "replace_your_key"  
     endpoint = ""  
     # Add your location, also known as region. The default is global.  
     # This is required if using a Cognitive Services resource.  
     location = "global"  
     path = '/translate'  
     constructed_url = endpoint + path  
     params = {  
         'api-version': '3.0',  
         'from': 'en',  
         'to': ['de', 'it']  
     constructed_url = endpoint + path  
     headers = {  
         'Ocp-Apim-Subscription-Key': subscription_key,  
         'Ocp-Apim-Subscription-Region': location,  
         'Content-type': 'application/json',  
         'X-ClientTraceId': str(uuid.uuid4())  
     # You can pass more than one object in body.  
     body = [{  
         'text': 'Hello World!'  
     request =, params=params, headers=headers, json=body)  
     response = request.json()  
     print(json.dumps(response, sort_keys=True, ensure_ascii=False, indent=4, separators=(',', ': ')))  

    Hope this helps.


  2. ReMiKU 6 Reputation points

    With the help of MutedJam over on n8n community the problem has been solved

    0 comments No comments