MachineTranslation.com API Documentation
Last updated 5 months ago
The MachineTranslation.com API provides a streamlined and efficient way to translate content between different languages.
It supports:
- Plain text translation via JSON requests
- Structured JSON file translation, where keys and structure are preserved, and only string values are translated
The API supports multiple translation engines, ensuring reliable and high-quality translations for various language pairs.
Base URLs
Text translation:
JSON file translation:
Authentication
The API uses BEARER for authentication. Include your API key in the Authorization header for each request.
Example
Request an API Key
To access the MachineTranslation.com API, you need an API key. Contact us → to request an API key.
Endpoints
Create Translation (Text)
Translate plain text from one language to another.
HTTP Request
Headers
Authorization: BEARER <your_api_key> Content-Type: application/json
Request Body
{
"text": "The text you want to translate",
"source_language_code": "en",
"target_language_code": "fr"
}| Field | Type | Required | Description |
|---|---|---|---|
| text | string | Yes | Text to be translated |
| source_language_code | string | Yes | Source language code (e.g. en) |
| target_language_code | string | Yes | Target language code (e.g. fr) |
Example Request
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 Example
{
"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
}
}Response Fields
translations: Array of translation results from different enginesengine: Translation engine usedshare_id: Unique ID for the translationsource_text: Original texttarget_text: Translated textsource_word_count: Word count of source texttarget_word_count: Word count of translated textsource_language_code: Source language codetarget_language_code: Target language codemeta.short_url: Shareable URLmeta.total_words: Total word count
Translate JSON File
Translate a .json file while preserving its original structure.
- JSON keys and structure are preserved
- Only string values are translated
- Numbers, booleans, arrays, and objects remain unchanged
HTTP Request
Headers
Authorization: BEARER <your_api_key> Content-Type: multipart/form-data
Request Body (form-data)
| Field | Type | Required | Description |
|---|---|---|---|
| file | file | Yes | JSON file to translate |
| source_language_code | string | Yes | Source language code (e.g. en) |
| target_language_code | string | Yes | Target language code (e.g. fr) |
Example Request
curl --location 'https://api.machinetranslation.com/pv1/translate/file' \ --header 'Authorization: BEARER <your_api_key>' \ --form 'file=@"/path/to/file.json"' \ --form 'source_language_code="en"' \ --form 'target_language_code="fr"'
Response Example
{
"translated_json": {
"title": "Texte traduit",
"description": "La structure JSON originale est conservée"
},
"source_language_code": "en",
"target_language_code": "fr"
}Notes
- The response returns a
translated_jsonobject with the same structure as the uploaded file.
Supported Languages
Below are the supported languages and their codes:
AI Translation Models & Smart AI Translation
MachineTranslation.com aggregates translations from multiple AI translation sources.
Rather than relying on a single model or provider, the platform compares outputs across top AI sources and applies SMART AI Translation to return the most reliable result by default.
Currently Supported Translation Sources
MachineTranslation.com currently supports AI and machine translation sources including, but not limited to: