Text Processing

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.

POST/v1/text/translate

Translate text

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

  • Name
    source_text
    Type
    array of strings
    Description

    List of texts to translate.

  • Name
    source_language
    Type
    string
    Description

    The source language code (e.g., "en").

  • Name
    target_language
    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
    provider
    Type
    string
    Description

    The AI provider to use: openai, anthropic, mistral, gemini, lara, widn (default: openai).

  • Name
    context_window
    Type
    integer
    Description

    Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).

  • Name
    glossaries
    Type
    array of integers
    Description

    List of glossary IDs to use for terminology consistency.

  • Name
    context_stores
    Type
    array of integers
    Description

    Context store IDs for styleguide content.

  • Name
    instructions
    Type
    string
    Description

    Additional instructions for the translation.

  • Name
    extra_instructions
    Type
    array of strings
    Description

    Additional instructions passed to the translation provider.

Request

POST
/v1/text/translate
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"
}

POST/v1/text/translate/stream

Stream translate text

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

  • Name
    source_text
    Type
    array of strings
    Description

    List of texts to translate. The stream translates the first item.

  • Name
    source_language
    Type
    string
    Description

    The source language code (e.g., "en").

  • Name
    target_language
    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
    provider
    Type
    string
    Description

    The AI provider to use: openai, anthropic, mistral, gemini, lara, widn (default: openai).

  • Name
    context_window
    Type
    integer
    Description

    Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).

  • Name
    glossaries
    Type
    array of integers
    Description

    List of glossary IDs to use for terminology consistency.

  • Name
    context_stores
    Type
    array of integers
    Description

    Context store IDs for styleguide content.

  • Name
    instructions
    Type
    string
    Description

    Additional instructions for the translation.

  • Name
    extra_instructions
    Type
    array of strings
    Description

    Additional instructions passed to the translation provider.

Request

POST
/v1/text/translate/stream
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"}

POST/v1/text/revise

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 AIPE handler.

Required attributes

  • Name
    source_text
    Type
    string
    Description

    The original source text.

  • Name
    target_text
    Type
    string
    Description

    The existing translation to revise.

  • Name
    source_language
    Type
    string
    Description

    The source language code (e.g., "en").

  • Name
    target_language
    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
    provider
    Type
    string
    Description

    The AI provider to use: openai, anthropic, mistral, gemini (default: openai).

  • Name
    context_window
    Type
    integer
    Description

    Processing mode (1=full_document, 2=bucketing, 3=segment_per_segment, default: 3).

  • Name
    glossaries
    Type
    array of integers
    Description

    List of glossary IDs to use for terminology consistency.

  • Name
    context_stores
    Type
    array of integers
    Description

    Context store IDs for styleguide content.

  • Name
    instructions
    Type
    string
    Description

    Additional instructions for the revision.

  • Name
    styleguide
    Type
    string
    Description

    Direct styleguide text to follow for the revision. Used if context_stores is not provided.

Request

POST
/v1/text/revise
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"
}

POST/v1/text/rewrite

Rewrite text

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

  • Name
    source_text
    Type
    string
    Description

    The text to rewrite.

  • Name
    source_language
    Type
    string
    Description

    The language code of the text (e.g., "en").

  • Name
    type
    Type
    string
    Description

    The rewrite type. One of: simplify, summarize, elaborate, continue, align.

Optional attributes

  • Name
    domain
    Type
    string
    Description

    Content domain for the rewrite (e.g., "technical", "legal", "marketing").

  • Name
    glossaries
    Type
    array of integers
    Description

    List of glossary IDs to use for terminology consistency.

  • Name
    context_stores
    Type
    array of integers
    Description

    Context store IDs for styleguide content.

  • Name
    instructions
    Type
    string
    Description

    Additional rewriting instructions.

  • Name
    template
    Type
    integer
    Description

    Explicit prompt template ID override.

Request

POST
/v1/text/rewrite
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
}

POST/v1/text/rewrite/stream

Stream rewrite text

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

  • Name
    source_text
    Type
    string
    Description

    The text to rewrite.

  • Name
    source_language
    Type
    string
    Description

    The language code of the text (e.g., "en").

  • Name
    type
    Type
    string
    Description

    The rewrite type. One of: simplify, summarize, elaborate, continue, align.

Optional attributes

  • Name
    domain
    Type
    string
    Description

    Content domain for the rewrite (e.g., "technical", "legal", "marketing").

  • Name
    glossaries
    Type
    array of integers
    Description

    List of glossary IDs to use for terminology consistency.

  • Name
    context_stores
    Type
    array of integers
    Description

    Context store IDs for styleguide content.

  • Name
    instructions
    Type
    string
    Description

    Additional rewriting instructions.

  • Name
    template
    Type
    integer
    Description

    Explicit prompt template ID override.

Request

POST
/v1/text/rewrite/stream
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"}

Was this page helpful?