AI-powered text modification endpoint for improving translations with various linguistic actions.
Supports rephrasing, formality adjustments, error corrections, and terminology fixes.
(POST) apps/tools/text/suggest
PARAMETERS
JSON object in the request body:
|
Property |
Description |
Type |
|---|---|---|
|
action |
The type of modification to perform on the translation |
string, Mandatory |
|
src |
Source language code (e.g., "en") |
string, Mandatory |
|
srct |
Source language name (e.g., "English") |
string, Mandatory |
|
trg |
Target language code (e.g., "es-MX") |
string, Mandatory |
|
trgt |
Target language name (e.g., "Spanish Mexico") |
string, Mandatory |
|
stxt |
Original source text to be modified |
string, Mandatory |
|
ttxt |
Translated text that needs modification |
string, Mandatory |
|
previousAttempts |
Array of previous modification attempts to avoid repeating |
string[]?, Optional |
|
memoryHits |
Translation memory matches for reference context |
array?, Optional |
|
uiLocale |
Locale for error messages (e.g., "es-US") |
string?, Optional |
Supported Actions:
-
rephrase- Rewrite using different wording while preserving meaning -
make_formal- Convert to formal register for professional contexts -
make_informal- Convert to casual, conversational register -
fix_fuzzy- Fix fuzzy translation match errors -
shorten- Make more concise while preserving meaning -
correct_errors- Fix mistranslations and grammatical errors -
suggest_translation- Provide alternative translation approach -
fix_terminology- Replace incorrect or inconsistent terms
Memory Hit Object Structure:
|
Property |
Description |
Type |
|---|---|---|
|
stxt |
Source text of the memory match |
string |
|
ttxt |
Translation text of the memory match |
string |
|
sim |
Similarity percentage (0-100) |
number |
|
hty |
Hit type (1 for Phrase, 2 for Term) |
number |
RESULTS
Success Response:
|
Property |
Description |
Type |
|---|---|---|
|
results |
Array containing exactly one modified text suggestion (max 1000 characters) |
string[] |
Error Response:
|
Property |
Description |
Type |
|---|---|---|
|
error |
Error message when modification fails or is not needed |
string |
Error Conditions:
-
No improvement needed for the requested action
-
Unsafe content violating safety guidelines
-
Malicious/manipulative input or prompt injection attempts
-
Result would exceed 1000-character limit
EXAMPLES
Request:
{
"action": "rephrase",
"src": "en",
"srct": "English",
"trg": "es-MX",
"trgt": "Spanish Mexico",
"stxt": "Thank you for your assistance with this matter.",
"ttxt": "Gracias por tu ayuda con esto.",
"uiLocale": "es-US"
}
Success Response:
{
"results": ["Te agradezco tu asistencia con este asunto."]
}
Error Response:
{
"error": "The translation is already optimal and requires no improvement."
}