🌍 Multilingual Translation API
Fast and accurate translation between 28 languages, optimized for long texts and high performance. Supports both single and batch translation.
Try Demo
Try Our AI Demo
Login or create a free account to use this AI service demo and explore our powerful APIs.
Get 100 Free Credits (IC) when you sign up!
Offer ends December 31, 2025
🚀 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.
| Mode | Avg Time / 100 Sentences |
|---|---|
| 🧠 Batch | 18.06 sec |
| 🐌 Single | 30.54 sec |
💡 Tip: Use the batch API for best performance.
🧪 Quality (BERTScore)
Semantic similarity score between prediction and reference (1.0 = perfect match)
| Source → Target | BERTScore Mean |
|---|---|
| EN → MY | 0.9561 |
| EN → TH | 0.9506 |
| EN → JA | 0.9169 |
| JA → EN | 0.9146 |
| TH → EN | 0.8728 |
| TH → MY | 0.8571 |
| ZH → EN | 0.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 translatesource_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
| Code | Description |
|---|---|
| 400 | Invalid request |
| 401 | Missing or invalid API key |
| 429 | Rate limit exceeded |
| 500 | Internal server error |
| 503 | Service not ready |
✅ Summary
- 🏁 Fast & accurate for 28 languages
- 📄 Handles long text automatically
- 🧪 Proven high-quality translations
- 📦 Use batch mode for best speed
Code Examples
Curl
curl -X POST https://api.iapp.co.th/v3/store/nlp/translation/multilingual \
-H "apikey: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Your text here", "source_lang": "th", "target_lang": "en"}'
Python
import requests
import json
url = "https://api.iapp.co.th/v3/store/nlp/translation/multilingual"
headers = {
"apikey": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {"text": "Your text here", "source_lang": "th", "target_lang": "en"}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
JavaScript
const axios = require("axios");
const config = {
method: "post",
url: "https://api.iapp.co.th/v3/store/nlp/translation/multilingual",
headers: {
apikey: "YOUR_API_KEY",
"Content-Type": "application/json",
},
data: {"text": "Your text here", "source_lang": "th", "target_lang": "en"},
};
axios(config)
.then((response) => console.log(response.data))
.catch((error) => console.log(error));
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.iapp.co.th/v3/store/nlp/translation/multilingual',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => '{"text": "Your text here", "source_lang": "th", "target_lang": "en"}',
CURLOPT_HTTPHEADER => array(
'apikey: YOUR_API_KEY',
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>
Swift
import Foundation
let url = URL(string: "https://api.iapp.co.th/v3/store/nlp/translation/multilingual")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.addValue("YOUR_API_KEY", forHTTPHeaderField: "apikey")
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
let jsonData = try! JSONSerialization.data(withJSONObject: {"text": "Your text here", "source_lang": "th", "target_lang": "en"})
request.httpBody = jsonData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8)!)
}
}
task.resume()
Kotlin
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody.Companion.toRequestBody
val client = OkHttpClient()
val json = """
{"text": "Your text here", "source_lang": "th", "target_lang": "en"}
""".trimIndent()
val requestBody = json.toRequestBody("application/json".toMediaTypeOrNull())
val request = Request.Builder()
.url("https://api.iapp.co.th/v3/store/nlp/translation/multilingual")
.addHeader("apikey", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
Java
import okhttp3.*;
OkHttpClient client = new OkHttpClient();
String json = "{"text": "Your text here", "source_lang": "th", "target_lang": "en"}";
RequestBody body = RequestBody.create(
MediaType.parse("application/json"),
json
);
Request request = new Request.Builder()
.url("https://api.iapp.co.th/v3/store/nlp/translation/multilingual")
.addHeader("apikey", "YOUR_API_KEY")
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
Dart
import 'package:http/http.dart' as http;
import 'dart:convert';
var headers = {
'apikey': 'YOUR_API_KEY',
'Content-Type': 'application/json'
};
var data = {"text": "Your text here", "source_lang": "th", "target_lang": "en"};
var response = await http.post(
Uri.parse('https://api.iapp.co.th/v3/store/nlp/translation/multilingual'),
headers: headers,
body: jsonEncode(data)
);
print(response.body);