MachineTranslation.com API Documentation

Overview

The MachineTranslation.com API provides a streamlined and efficient way to translate text between different languages. This API focuses on a simple process: receiving the source text, performing the translation, and sending back the translated text. It supports multiple translation engines, ensuring reliable and high-quality translations for various language pairs.

Base URL

https://api.machinetranslation.com/v2/translation

Authentication

The API uses JSON Web Tokens (JWT) for authentication. Include your JWT in the Authorization header for each request.

Example

Authorization: JWT <your_jwt_token>

Request an API Key

To access the MachineTranslation.com API, you need an API key. Contact us to request for an API key.

Endpoints

Create Translation

Translate text from one language to another using a specified translation engine.

HTTP Request

POST /internal

Headers

  • Authorization: JWT <your_jwt_token>

  • Content-Type: application/json

Request Body

{
    "text": "The text you want to translate",
    "source_language_code": "source_language_code",
    "target_language_code": "target_language_code"
}
  • text: (string) The text to be translated.

  • source_language_code: (string) The language code of the source text (e.g., "en" for English).

  • target_language_code: (string) The language code of the target text (e.g., "hi" for Hindi).

Example Request

curl --location 'http://localhost:8000/v2/translation/internal' \
--header 'Authorization: JWT <your_jwt_token>' \
--header 'Content-Type: application/json' \
--data '{
    "text": "MachineTranslation.com translates, compares, and recommends the best translations.",
    "source_language_code": "en",
    "target_language_code": "fr"
}'

Response

{
    "translations": [
        {
            "engine": "google",
            "share_id": "cf733e14-ea86-4f6b-92fc-de9813197601",
            "source_text": "MachineTranslation.com translates, compares, and recommends the best translations.",
            "target_text": "MachineTranslation.com traduit, compare et recommande les meilleures traductions.",
            "source_word_count": 8,
            "target_word_count": 8,
            "source_language_code": "en",
            "target_language_code": "fr"
        },
        ...
    ],
    "meta": {
        "short_url": "https://machinetranslation.com/translations/cf733e14-ea86-4f6b-92fc-de9813197601",
        "total_words": 8
    }
}
  • translations: An array of translation results from different engines.

    • engine: (string) The translation engine used.

    • share_id: (string) The share ID of the translation.

    • source_text: (string) The original text.

    • target_text: (string) The translated text.

    • source_word_count: (number) Word count of the source text.

    • target_word_count: (number) Word count of the translated text.

    • source_language_code: (string) Language code of the source text.

    • target_language_code: (string) Language code of the translated text.

  • meta: Metadata related to the translation request.

    • short_url: (string) Short URL for the translation.

    • total_words: (number) Total word count of the source text.

Supported Languages

Below are the supported languages and their codes:

Translation Engines

MachineTranslation.com supports the following translation engines:

  • Google

  • DeepL

  • Amazon

  • ModernMT

  • Microsoft

  • ChatGPT

  • LibreTranslate

  • IBM

  • Lingvanex

  • Niutrans

  • Royalflush

Last updated