Page not found while calling url https://api.cognitive.microsofttranslator.com/

Roha Group 0 Reputation points
2025-11-01T08:53:06.4766667+00:00

while calling translator url https://api.cognitive.microsofttranslator.com/ we are getting page not found error 404. Even we have added host entry in our system but still we are getting same error. kindly advise how to call this url

Also we have already generated require api key to use this url .

Azure AI Translator
Azure AI Translator
An Azure service to easily conduct machine translation with a simple REST API call.
{count} votes

2 answers

Sort by: Most helpful
  1. Moritz Goeke 395 Reputation points MVP
    2025-11-01T22:24:51.3366667+00:00

    Hi,

    The base URL alone (https://api.cognitive.microsofttranslator.com/) will not work by itself.

    You must call a specific route, such as /translate, /detect, /languages, etc.

    Example using cURL:

    curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=de" \
      -H "Ocp-Apim-Subscription-Key: <YOUR_API_KEY>" \
      -H "Ocp-Apim-Subscription-Region: <YOUR_REGION>" \
      -H "Content-Type: application/json" \
      -d "[{'Text':'Hello world!'}]"
    
    

    You can find more information at: https://learn.microsoft.com/en-us/azure/ai-services/translator/text-translation/reference/v3/reference

    Hope that helps :),

    Best regards!

    0 comments No comments

  2. Nikhil Jha (Accenture International Limited) 3,985 Reputation points Microsoft External Staff Moderator
    2025-11-04T06:58:24.3533333+00:00

    Hello Roha Group,

    I understand you’re receiving a 404 “page not found” error while calling the Translator API, even after adding the host entry and using a valid key. Thanks to our community volunteer for providing prompt answer.

    To expand on that, I can explain why you are seeing the 404 Page Not Found error.

    The Cause: API Endpoint vs. Website URL

    • The URL https://api.cognitive.microsofttranslator.com/ is the base URI for the API, not a "page" you can visit in a browser or call directly. Think of it as the main address for an office building. You are getting a 404 error because you "arrived" at the building but didn't provide a "room number" (the specific operation you want to perform).
    • An API requires you to call a specific operation or route that is appended to that base URI.
    • I also noticed you mentioned adding a "host entry." That is a good step for a DNS or "server not found" error, but it won't fix a 404 error, which means you did successfully find the server, but the specific "page" (or operation) you asked for doesn't exist.

    The Solution: Use a Specific Operation

    As the volunteer's example shows, you must call a specific operation like /translate or /detect.

    A valid call must include three key pieces of information:

    1. The Full URL: The base URI plus the operation. Example: https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=de
    2. Your API Key: Sent in the request header. Header: Ocp-Apim-Subscription-Key: <YOUR_API_KEY_HERE>
    3. Your Region: This is often missed. The API key is tied to the Azure region where you created the resource (e.g., eastus, westeurope). Header: Ocp-Apim-Subscription-Region: <YOUR_REGION_HERE>

    I strongly recommend you review the official Translator Text API Reference, which lists all the available operations and provides code examples for multiple languages.


    Please accept and vote for the answer to help other members of the community.
    Thank you for helping to improve Microsoft Q&A! 😊User's image

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.