Skip to main content
Direct text processing endpoints allow you to translate, revise, and rewrite text synchronously without creating background jobs. These endpoints return results immediately, making them ideal for real-time applications. Streaming variants are available for translate and rewrite, delivering results via Server-Sent Events.

Translate text

POST /v1/text/translate This endpoint allows you to translate text directly using AI. It accepts a list of source texts and returns a corresponding list of translations.

Required attributes

source_text
array of strings
required
List of texts to translate.
source_language
string
required
The source language code (e.g., “en”).
target_language
string
required
The target language code (e.g., “de”).

Optional attributes

domain
string
Content domain for the translation (e.g., “technical”, “legal”, “marketing”).
provider
string
The AI provider to use: openai, anthropic, mistral, gemini, lara, widn (default: openai).
context_window
integer
Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).
glossaries
array of integers
List of glossary IDs to use for terminology consistency.
context_stores
array of integers
Context store IDs for styleguide content.
instructions
string
Additional instructions for the translation.
extra_instructions
array of strings
Additional instructions passed to the translation provider.
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_language": "en",
    "target_language": "de",
    "domain": "technical",
    "glossaries": [1]
  }'
Response
{
  "status": "success",
  "source_text": ["Welcome to our product documentation."],
  "translated_text": ["Willkommen in unserer Produktdokumentation."],
  "source_language": "en",
  "target_language": "de",
  "provider": "openai",
  "domain": "technical",
  "context_window": 3,
  "processing_mode": "direct"
}

Stream translate text

POST /v1/text/translate/stream This endpoint streams translated text via Server-Sent Events. It accepts the same request body as the synchronous translate endpoint but streams the translation of the first text in the source_text list. The stream emits three event types:
  • delta — A chunk of translated text: {"text": "..."}
  • done — The final result with metadata: {"text": "...", "source_language": "...", ...}
  • error — An error occurred: {"error": "...", "status": 402|400|500}

Required attributes

source_text
array of strings
required
List of texts to translate. The stream translates the first item.
source_language
string
required
The source language code (e.g., “en”).
target_language
string
required
The target language code (e.g., “de”).

Optional attributes

domain
string
Content domain for the translation (e.g., “technical”, “legal”, “marketing”).
provider
string
The AI provider to use: openai, anthropic, mistral, gemini, lara, widn (default: openai).
context_window
integer
Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).
glossaries
array of integers
List of glossary IDs to use for terminology consistency.
context_stores
array of integers
Context store IDs for styleguide content.
instructions
string
Additional instructions for the translation.
extra_instructions
array of strings
Additional instructions passed to the translation provider.
curl -N -X POST https://api.elanlanguages.ai/v1/text/translate/stream \
  -H "Authorization: Bearer {token}" \
  -H "X-Org-Id: {orgId}" \
  -H "Content-Type: application/json" \
  -d '{
    "source_text": ["Welcome to our product documentation."],
    "source_language": "en",
    "target_language": "de"
  }'
Response (SSE)
event: delta
data: {"text": "Willkommen"}

event: delta
data: {"text": " in unserer"}

event: delta
data: {"text": " Produktdokumentation."}

event: done
data: {"text": "Willkommen in unserer Produktdokumentation.", "source_language": "en", "target_language": "de"}

Revise text

POST /v1/text/revise 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 AIPE handler.

Required attributes

source_text
string
required
The original source text.
target_text
string
required
The existing translation to revise.
source_language
string
required
The source language code (e.g., “en”).
target_language
string
required
The target language code (e.g., “de”).

Optional attributes

domain
string
Content domain for the revision (e.g., “technical”, “legal”, “marketing”).
provider
string
The AI provider to use: openai, anthropic, mistral, gemini (default: openai).
context_window
integer
Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).
glossaries
array of integers
List of glossary IDs to use for terminology consistency.
context_stores
array of integers
Context store IDs for styleguide content.
instructions
string
Additional instructions for the revision.
styleguide
string
Direct styleguide text to follow for the revision. Used if context_stores is not provided.
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.",
    "target_text": "Wilkommen zu unsere Produktdokumentation.",
    "source_language": "en",
    "target_language": "de",
    "domain": "technical"
  }'
Response
{
  "status": "success",
  "source_text": "Welcome to our product documentation.",
  "original_target_text": "Wilkommen zu unsere Produktdokumentation.",
  "revised_text": "Willkommen in unserer Produktdokumentation.",
  "source_language": "en",
  "target_language": "de",
  "provider": "openai",
  "domain": "technical",
  "context_window": 3,
  "processing_mode": "direct"
}

Rewrite text

POST /v1/text/rewrite This endpoint allows you to rewrite text using AI. You specify a rewrite type to control how the text is transformed — for example, simplifying complex language, summarizing long passages, or elaborating on brief content.

Required attributes

source_text
string
required
The text to rewrite.
source_language
string
required
The language code of the text (e.g., “en”).
type
string
required
The rewrite type. One of: simplify, summarize, elaborate, continue, align.

Optional attributes

domain
string
Content domain for the rewrite (e.g., “technical”, “legal”, “marketing”).
glossaries
array of integers
List of glossary IDs to use for terminology consistency.
context_stores
array of integers
Context store IDs for styleguide content.
instructions
string
Additional rewriting instructions.
template
integer
Explicit prompt template ID override.
curl -X POST https://api.elanlanguages.ai/v1/text/rewrite \
  -H "Authorization: Bearer {token}" \
  -H "X-Org-Id: {orgId}" \
  -H "Content-Type: application/json" \
  -d '{
    "source_text": "The implementation of the aforementioned functionality necessitates the utilization of advanced computational paradigms.",
    "type": "simplify",
    "source_language": "en"
  }'
Response
{
  "status": "success",
  "source_text": "The implementation of the aforementioned functionality necessitates the utilization of advanced computational paradigms.",
  "rewritten_text": "Building this feature requires advanced computing techniques.",
  "source_language": "en",
  "domain": null,
  "type": "simplify",
  "template": null
}

Stream rewrite text

POST /v1/text/rewrite/stream This endpoint streams rewritten text via Server-Sent Events. It accepts the same request body as the synchronous rewrite endpoint but delivers results incrementally as they are generated. The stream emits three event types:
  • delta — A chunk of rewritten text: {"text": "..."}
  • done — The final result with metadata: {"text": "...", "source_language": "...", ...}
  • error — An error occurred: {"error": "...", "status": 402|400|500}

Required attributes

source_text
string
required
The text to rewrite.
source_language
string
required
The language code of the text (e.g., “en”).
type
string
required
The rewrite type. One of: simplify, summarize, elaborate, continue, align.

Optional attributes

domain
string
Content domain for the rewrite (e.g., “technical”, “legal”, “marketing”).
glossaries
array of integers
List of glossary IDs to use for terminology consistency.
context_stores
array of integers
Context store IDs for styleguide content.
instructions
string
Additional rewriting instructions.
template
integer
Explicit prompt template ID override.
curl -N -X POST https://api.elanlanguages.ai/v1/text/rewrite/stream \
  -H "Authorization: Bearer {token}" \
  -H "X-Org-Id: {orgId}" \
  -H "Content-Type: application/json" \
  -d '{
    "source_text": "The implementation of the aforementioned functionality necessitates the utilization of advanced computational paradigms.",
    "type": "simplify",
    "source_language": "en"
  }'
Response (SSE)
event: delta
data: {"text": "Building this"}

event: delta
data: {"text": " feature requires"}

event: delta
data: {"text": " advanced computing techniques."}

event: done
data: {"text": "Building this feature requires advanced computing techniques.", "source_language": "en", "type": "simplify"}