Tilde MT API integration
Integrate machine translation into your application or website with Tilde MT API.
- Translate text and files effortlessly: Tilde MT API supports plaintext as well as most common office files, images, web and interchange formats.
- Customize translations with Glossaries: Ensure translation accuracy for industry-specific terms or brand names. Create private glossaries on Tilde MT platform and use them to improve translations.
Explore the Swagger API specification: https://translate.tilde.ai/api-description
Try the .NET library: Github repository
See the list of supported languages: Language support
Service endpoint
A service endpoint is a base URL that specifies the network address of an API service. Tilde MT service has the following service endpoint and all URIs below are relative to this service endpoint:
https://translate.tilde.ai/api/
Step 1: Authentication
The API uses an access key for authentication. Log into the Tilde MT platform, and create a new access key https://translate.tilde.ai/access-keys. Read more about access keys: Create an access key on Tilde MT platform.
You must include an X-Api-Key
header in your request with your unique key.
Header Example:
X-Api-Key: YOUR_API_KEY
Replace YOUR_API_KEY
with your actual access key. Requests without a valid access key in the X-Api-Key
header will be rejected.
Step 2: Translate text
Text translation is accessible at the following URL: https://translate.tilde.ai/api/translate/text
To translate text, you'll make a POST
request to the /translate/text
endpoint. This endpoint translates one or more text segments from a source language to a target language. The request body must be in JSON format (application/json
).
- HTTP Request
- cURL
- Node.js
POST https://translate.tilde.ai/api/translate/text HTTP/2
Host: translate.tilde.ai
accept: text/plain
content-length: 141
content-type: application/json
x-api-key: YOUR_API_KEY
{
"srcLang": "en",
"trgLang": "de",
"domain": "general",
"text": [
"Hello, world!",
"How are you?"
],
"termCollections": []
}
curl -X 'POST' \
'https://translate.tilde.ai/api/translate/text' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-H 'X-Api-Key: YOUR_API_KEY' \
-d '{
"srcLang": "en",
"trgLang": "de",
"domain": "general",
"text": [
"Hello, world!",
"How are you?"
],
"termCollections": []
}'
import axios from 'axios';
async function translateText() {
const url = 'https://translate.tilde.ai/api/translate/text';
const headers = {
'Content-Type': 'application/json',
'X-API-KEY': 'YOUR_API_KEY',
'accept': 'text/plain',
};
const body = {
srcLang: 'en',
trgLang: 'de',
domain: 'general',
text: ['Hello, world!', 'How are you?'],
termCollections: [],
};
try {
const response = await axios.post(url, body, { headers });
console.log('Status:', response.status);
console.log('Body:', response.data);
} catch (error) {
console.error('Error making the request:', error.response ? error.response.data : error.message);
}
}
translateText();
{
"domain": "General",
"translations": [
{
"translation": "Hallo Welt!"
},
{
"translation": "Wie geht es dir?"
}
],
"detectedLanguage": null
}
Parameters
The main object in your request body should contain the following fields:
Parameter | Type | Required | Description |
---|---|---|---|
text | Array of Strings | Yes | An array of text segments to be translated. Each string is treated as an individual segment. |
srcLang | String (max 10 chars) | No | The language code of the source text (e.g., en , lv ). If omitted, the API attempts to auto-detect the language. |
trgLang | String (max 10 chars) | Yes | The language code for the desired translation (e.g., fr , de ). |
domain | String (max 200 chars) | No | Specifies a subject area or domain for the translation to use a domain-specific translation engine. Available domains are general and general ai with custom domains for private engines. |
engineId | String (UUID) | No | The unique identifier of a specific custom translation engine to use. |
termCollections | Array of Strings (UUID) | No | A list of unique identifiers for term collections (glossaries) to be applied during translation. If a glossary is selected when creating an access key on the platform or set as default glossary this field can be left empty. |
Responses
200 - OK
{
"domain": "string",
"translations": [
{
"translation": "string"
}
],
"detectedLanguage": "string"
}
400 - Missing or incorrect parameters
This error occurs when a required parameter of the request is missing or one of the specified parameters is not supported, is misspelled, or the value is wrong.
404 - Language direction is not found
This error occurs when the requested language direction is not supported or available. Refer to the supported language list and check your access key configuration on the Tilde MT platform if you've limited it to specific translation languages.
413 - Maximum text size limit reached for the request
This error occurs when the request size reaches the size limit.
To avoid request size limits and potential timeouts, segment large text bodies into smaller chunks (like paragraphs or sentences) and send each in a separate API call.
429 - Too many requests
If you receive this error, retry the request after a short delay. If it persists, progressively increase the delay between retries until the request is successful.
500 - An unexpected error occured
50X are internal errors. You should contact support and provide as much detail as possible about the request, including the data sent and the time of the error, so we can investigate.
504 - Request timed out
To avoid potential timeouts, segment large text bodies into smaller chunks (like paragraphs or sentences) and send each in a separate API call. If the error persists contact support.
Step 3: Translate files
To translate files, you'll make requests to the /translate/file
endpoint.
For file translation specification, please refer to Swagger
- Specify file to translate, translation languages and domain.
- Start document translation.
- Wait for document translation to finish. Status has to be "Completed".
- Save file.
Tilde MT API supports the following file formats: .docx
, .doc
, .docm
, .xlsx
, .pptx
, .pdf
, .odt
, .odp
, .ods
, .txt
, .rtf
, .pages
, .sxw
, .jpg
, .jpeg
, .png
, .bmp
, .sdlxliff
, .sdlxlf
, .ttx
, .tmx
, .xlf
, .xlif
, .xliff
, .html
, .htm
, .json
, .xhtml
, .xht
, .tex
, .srt
.