# 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

```bash
https://api.machinetranslation.com/pv1/translate
```

### Authentication

The API uses BEARER for authentication. Include your API key in the `Authorization` header for each request.

#### Example

```bash
Authorization: BEARER <your_api_key>
```

### Request an API Key

To access the MachineTranslation.com API, you need an API key. [Contact us](https://developer.machinetranslation.com/) to request for an API key.

### Endpoints

#### Create Translation

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

**HTTP Request Method**

```bash
POST 
```

**Headers**

* `Authorization: BEARER <your_api_key>`
* `Content-Type: application/json`

**Request Body**

```json
{
    "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**

```bash
curl --location 'https://api.machinetranslation.com/pv1/translate' \
--header 'Authorization: BEARER <your_api_key>' \
--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**

```json
{
    "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:

| Language Name            | Code     |
| ------------------------ | -------- |
| Acehnese                 | ace      |
| Afrikaans                | af       |
| Albanian                 | sq       |
| Amharic                  | am       |
| Arabic                   | ar       |
| Armenian                 | hy       |
| Assamese                 | as       |
| Asturian                 | ast      |
| Awadhi                   | awa      |
| Ayacucho Quechua         | quy      |
| Aymara                   | ay       |
| Aymara, Central          | ayr      |
| Azerbaijani              | az       |
| Azerbaijani, Northern    | azj      |
| Azerbaijani, Southern    | azb      |
| Balinese                 | ban      |
| Bambara                  | bm       |
| Banjar                   | bjn      |
| Bashkir                  | ba       |
| Basque                   | eu       |
| Belarusian               | be       |
| Bemba                    | bem      |
| Bengali                  | bn       |
| Bhojpuri                 | bho      |
| Bodo                     | brx      |
| Bosnian                  | bs       |
| Buginese                 | bug      |
| Bulgarian                | bg       |
| Cantonese (Traditional)  | yue      |
| Catalan                  | ca       |
| Cebuano                  | ceb      |
| Chhattisgarhi            | hne      |
| Chinese (Literary)       | lzh      |
| Chinese (Simplified)     | zh       |
| Chinese (Traditional)    | zh-TW    |
| Chokwe                   | cjk      |
| Corsican                 | co       |
| Crimean Tatar            | crh      |
| Croatian                 | hr       |
| Czech                    | cs       |
| Danish                   | da       |
| Dari                     | fa-AF    |
| Dhivehi / Divehi         | dv       |
| Dimli                    | diq      |
| Dinka (Southwestern)     | dik      |
| Dogri                    | doi      |
| Dutch                    | nl       |
| Dyula                    | dyu      |
| Dzongkha                 | dz       |
| English                  | en       |
| Esperanto                | eo       |
| Estonian                 | et       |
| Ewe                      | ee       |
| Faroese                  | fo       |
| Fijian                   | fj       |
| Filipino, Tagalog        | tl       |
| Finnish                  | fi       |
| Fon                      | fon      |
| French                   | fr       |
| French (Canada)          | fr-CA    |
| Frisian                  | fy       |
| Friulian                 | fur      |
| Galician                 | gl       |
| Ganda                    | lg       |
| Georgian                 | ka       |
| German                   | de       |
| Greek                    | el       |
| Gujarati                 | gu       |
| Haitian Creole           | ht       |
| Halh Mongolian           | khk      |
| Hausa                    | ha       |
| Hawaiian                 | haw      |
| Hebrew                   | he       |
| Hindi                    | hi       |
| Hmong                    | hmn      |
| Hmong Daw                | mww      |
| Hungarian                | hu       |
| Icelandic                | is       |
| Igbo                     | ig       |
| Ilocano / Iloko          | ilo      |
| Indonesian               | id       |
| Inuinnaqtun              | iu       |
| Inuktitut                | ikt      |
| Inuktitut (Latin)        | iu-Latn  |
| Irish                    | ga       |
| Italian                  | it       |
| Japanese                 | ja       |
| Javanese                 | jv       |
| Jingpho                  | kac      |
| Kabiyè                   | kbp      |
| Kabuverdianu             | kea      |
| Kabyle                   | kab      |
| Kamba                    | kam      |
| Kannada                  | kn       |
| Kanuri, Central          | knc      |
| Kashmiri (Arabic)        | kas      |
| Kashmiri (Devanagari)    | ks       |
| Kazakh                   | kk       |
| Khmer                    | km       |
| Kikuyu                   | ki       |
| Kimbundu                 | kmb      |
| Kinyarwanda              | rw       |
| Kongo                    | kg       |
| Konkani                  | gom      |
| Korean                   | ko       |
| Krio                     | kri      |
| Kurdish                  | ku       |
| Kurdish (Kurmanji)       | kmr      |
| Kurdish (Sorani)         | ckb      |
| Kyrgyz                   | ky       |
| Lao                      | lo       |
| Latgalian                | ltg      |
| Latin                    | la       |
| Latvian                  | lv       |
| Ligurian                 | lij      |
| Limburgish               | li       |
| Lingala                  | ln       |
| Lithuanian               | lt       |
| Lombard                  | lmo      |
| Lower Sorbian            | dsb      |
| Luba-Kasai               | lua      |
| Luxembourgish            | lb       |
| Macedonian               | mk       |
| Magahi                   | mag      |
| Maithili                 | mai      |
| Malagasy                 | mg       |
| Malay                    | ms       |
| Malayalam                | ml       |
| Maltese                  | mt       |
| Manipuri                 | mni      |
| Maori                    | mi       |
| Marathi                  | mr       |
| Meiteilon (Manipuri)     | mni-Mtei |
| Minangkabau              | min      |
| Mizo                     | lus      |
| Mongolian                | mn       |
| Mongolian (Cyrillic)     | mn-Cyrl  |
| Mongolian (Traditional)  | mn-Mong  |
| Mossi                    | mos      |
| Myanmar (Burmese)        | my       |
| Nepali                   | ne       |
| Nigerian Fulfulde        | fuv      |
| Norwegian (Bokmål)       | no       |
| Norwegian (Nynorsk)      | nn       |
| Nuer                     | nus      |
| Nyanja (Chichewa)        | ny       |
| Occitan                  | oc       |
| Odia (Oriya)             | or       |
| Oromo                    | om       |
| Oromo (West Central)     | gaz      |
| Pangasinan               | pag      |
| Papiamento               | pap      |
| Pashto                   | ps       |
| Persian (Farsi)          | fa       |
| Polish                   | pl       |
| Pashto (Southern)        | pbt      |
| Plateau Malagasy         | plt      |
| Portuguese (Brazil)      | pt       |
| Portuguese (Portugal)    | pt-PT    |
| Punjabi                  | pa       |
| Quechua                  | qu       |
| Queretaro Otomi          | otq      |
| Romanian                 | ro       |
| Rundi                    | rn       |
| Russian                  | ru       |
| Shona                    | sn       |
| Samoan                   | sm       |
| Sango                    | sg       |
| Sanskrit                 | sa       |
| Santali                  | sat      |
| Sardinian                | sc       |
| Scots Gaelic             | gd       |
| Sepedi                   | nso      |
| Serbian (Cyrillic)       | sr-Cyrl  |
| Serbian (Latin)          | sr-Latn  |
| Sesotho                  | st       |
| Sesotho sa Leboa         | nso      |
| Shan                     | shn      |
| Sicilian                 | scn      |
| Silesian                 | szl      |
| Sindhi                   | sd       |
| Sinhala (Sinhalese)      | si       |
| Slovak                   | sk       |
| Slovenian                | sl       |
| Somali                   | so       |
| Somali (Arabic)          | so       |
| Sotho (Northern)         | nso      |
| Sotho (Southern)         | st       |
| Spanish                  | es       |
| Spanish (Latin America)  | es-419   |
| Spanish (Mexico)         | es-MX    |
| Standard Latvian         | lvs      |
| Standard Malay           | zsm      |
| Sundanese                | su       |
| Swahili                  | sw       |
| Swati                    | ss       |
| Swedish                  | sv       |
| Tahitian                 | ty       |
| Tajik                    | tg       |
| Tamasheq                 | taq      |
| Tamazight, Central Atlas | tzm      |
| Tamil                    | ta       |
| Tatar (Latin)            | tt       |
| Tatar / Tartar           | tt       |
| Telugu                   | te       |
| Thai                     | th       |
| Tibetan                  | bo       |
| Tigrinya                 | ti       |
| Tok Pisin                | tpi      |
| Tongan                   | to       |
| Tosk Albanian            | als      |
| Tsonga                   | ts       |
| Tswana / Setswana        | tn       |
| Tumbuka                  | tum      |
| Turkish                  | tr       |
| Turkmen                  | tk       |
| Twi                      | tw       |
| Twi (Akan)               | ak       |
| Ukrainian                | uk       |
| Umbundu                  | umb      |
| Upper Sorbian            | hsb      |
| Urdu                     | ur       |
| Uyghur                   | ug       |
| Uzbek (Latin)            | uz       |
| Uzbek (Northern)         | uzn      |
| Venetian                 | vec      |
| Vietnamese               | vi       |
| Waray (Philippines)      | war      |
| Welsh                    | cy       |
| Wolof                    | wo       |
| Xhosa                    | xh       |
| Yiddish                  | yi       |
| Yiddish (Eastern)        | ydd      |
| Yoruba                   | yo       |
| Yucatec Maya             | yua      |
| Zulu                     | zu       |

### Translation Engines

MachineTranslation.com supports the following translation engines:

* Google
* DeepL
* Amazon
* ModernMT
* Microsoft
* ChatGPT
* LibreTranslate
* IBM
* Lingvanex
* Niutrans
* Royalflush
* Groq
* ClaudeAI
* Gemini
