Skip to main content

🌍 Multilingual Translation 🆕

🌍 Multilingual Translation API

Version Status

Fast and accurate translation between 28 languages, optimized for long texts and high performance. Supports both single and batch translation.

Try Demo

Demo key is limited to 10 requests per day per IP
Click here to get your API key

🚀 Features

  • 28 Languages:
    ar, bn, cs, de, en, es, fa, fr, he, hi, id, it, ja, km, ko, lo, ms, my, nl, pl, pt, ru, th, tl, tr, ur, vi, zh

  • Single & Batch Endpoints

  • Unlimited Text Support – Automatic chunking at sentence level

  • High Accuracy – Evaluated with BERTScore on real-world datasets

📈 Performance Benchmark (Thai → English)

Tested on 133,330 sentence pairs from the SCB MT En-TH 2020 dataset.

ModeAvg Time / 100 Sentences
🧠 Batch18.06 sec
🐌 Single30.54 sec

💡 Tip: Use the batch API for best performance.

🧪 Quality (BERTScore)

Semantic similarity score between prediction and reference (1.0 = perfect match)

Source → TargetBERTScore Mean
EN → MY0.9561
EN → TH0.9506
EN → JA0.9169
JA → EN0.9146
TH → EN0.8728
TH → MY0.8571
ZH → EN0.8571

✅ All tested pairs scored > 0.80

📡 API Endpoints

🔹 Single Translation

POST /v1/text/translate
Content-Type: application/x-www-form-urlencoded

Params:

  • text: Text to translate
  • source_lang: Source language code (e.g. en)
  • target_lang: Target language code (e.g. th)
  • max_length: (optional) Max output tokens

Example:

curl -X POST "https://api.iapp.co.th/v1/text/translate" \
-H "apikey: YOUR_API_KEY" \
-F "text=Hello" \
-F "source_lang=en" \
-F "target_lang=th"

Response:

{
"translation": "สวัสดี",
"processing_time": 0.056
}

🔹 Batch Translation

POST /v1/text/batch_translate
Content-Type: application/json

Body:

[
{
"text": "Hello",
"source_lang": "en",
"target_lang": "fr"
},
{
"text": "こんにちは",
"source_lang": "ja",
"target_lang": "en"
}
]

Response:

{
"results": [
{ "translation": "Bonjour", "index": 0 },
{ "translation": "Hello", "index": 1 }
]
}

🐍 Python Code Example

import requests

def translate_text(text, source_lang, target_lang, api_key, api_url="https://api.iapp.co.th"):
"""
Translate text using the Translation API

Args:
text (str): Text to translate
source_lang (str): Source language code (e.g., 'en', 'th', 'zh')
target_lang (str): Target language code (e.g., 'en', 'th', 'zh')
api_key (str): Your API key
api_url (str): Base URL of the API

Returns:
dict: Translation response
"""
data = {
"text": text,
"source_lang": source_lang,
"target_lang": target_lang
}

headers = {
"apikey": api_key
}

response = requests.post(f"{api_url}/v1/text/translate", data=data, headers=headers)
response.raise_for_status() # Raise exception for HTTP errors
return response.json()

# Example usage:
# result = translate_text("Hello", "en", "th", api_key="YOUR_API_KEY")
# print(result["translation"])

✅ This code uses application/x-www-form-urlencoded format, consistent with the API spec.

⚠️ Errors

CodeDescription
400Invalid request
401Missing or invalid API key
429Rate limit exceeded
500Internal server error
503Service not ready

✅ Summary

  • 🏁 Fast & accurate for 28 languages
  • 📄 Handles long text automatically
  • 🧪 Proven high-quality translations
  • 📦 Use batch mode for best speed