Text Translation
Direct text translation endpoints allow you to translate and revise text synchronously without creating background jobs. These endpoints use the same AI-powered translation and post-editing capabilities but return results immediately, making them ideal for real-time applications and smaller content.
Translate text
This endpoint allows you to translate text directly using AI. It provides synchronous text translation without TMS integration, using the same translation adapters and processing logic as the translation job handler.
Required attributes
- Name
source_text- Type
- string
- Description
The text to translate.
- Name
source_lang- Type
- string
- Description
The source language code (e.g., "en").
- Name
target_lang- Type
- string
- Description
The target language code (e.g., "de").
Optional attributes
- Name
domain- Type
- string
- Description
Content domain for the translation (e.g., "technical", "legal", "marketing").
- Name
glossary_id- Type
- integer
- Description
Glossary ID to use for terminology consistency.
- Name
context_store_id- Type
- integer
- Description
Context store ID to provide reference materials via RAG.
- Name
quality_estimation- Type
- boolean
- Description
Whether to include quality estimation scores in the response.
Request
curl -X POST https://api.elanlanguages.ai/v1/text/translate \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}" \
-H "Content-Type: application/json" \
-d '{
"source_text": "Welcome to our product documentation.",
"source_lang": "en",
"target_lang": "de",
"domain": "technical",
"glossary_id": 1,
"quality_estimation": true
}'
Response
{
"translated_text": "Willkommen in unserer Produktdokumentation.",
"source_lang": "en",
"target_lang": "de",
"quality_score": 0.95,
"word_count": 5,
"execution_time_ms": 850
}
Revise text
This endpoint allows you to revise translated text directly using AI post-editing. It provides synchronous text revision without TMS integration, using the same post-editing adapters and processing logic as the post-editing job handler.
Required attributes
- Name
source_text- Type
- string
- Description
The original source text.
- Name
translated_text- Type
- string
- Description
The translation to revise.
- Name
source_lang- Type
- string
- Description
The source language code (e.g., "en").
- Name
target_lang- Type
- string
- Description
The target language code (e.g., "de").
Optional attributes
- Name
domain- Type
- string
- Description
Content domain for the revision (e.g., "technical", "legal", "marketing").
- Name
revision_type- Type
- string
- Description
Type of revision:
fluency(improve readability) oraccuracy(improve translation accuracy).
Request
curl -X POST https://api.elanlanguages.ai/v1/text/revise \
-H "Authorization: Bearer {token}" \
-H "X-Org-Id: {orgId}" \
-H "Content-Type: application/json" \
-d '{
"source_text": "Welcome to our product documentation.",
"translated_text": "Wilkommen zu unsere Produktdokumentation.",
"source_lang": "en",
"target_lang": "de",
"domain": "technical",
"revision_type": "accuracy"
}'
Response
{
"revised_text": "Willkommen in unserer Produktdokumentation.",
"source_text": "Welcome to our product documentation.",
"changes_made": [
{
"original": "Wilkommen",
"revised": "Willkommen",
"type": "spelling"
},
{
"original": "zu unsere",
"revised": "in unserer",
"type": "grammar"
}
],
"confidence_score": 0.92,
"word_count": 5
}