Loading...
Loading...
Loading...
We use essential storage to operate Lexel Translate. With your permission, we also use analytics, advertising, and marketing technologies. Read our Cookie Policy.
Loading...
Translate one logical text payload synchronously with glossary selection, structured-content handling, and placeholder protection.
/api/v1/translateNative translate endpoint.
Request example
/api/v1/translatecurl -X POST "https://translate.lexel.ai/api/v1/translate" \-H "Authorization: Bearer lxl_your_api_key" \-H "Content-Type: application/json" \-d '{"request_id": "req_translate_demo_001","src": "en-Latn","tgt": "fr-Latn","content_mode": "plain","preserve_placeholders": true,"do_not_translate": ["{name}"],"metadata": {"order_id": "ord_123"},"input": {"items": [{"txt": "Open a support ticket for {name}."}]}}'
Response example
{"ok": true,"request_id": "req_translate_demo_001","operation": "translate","source_language_tag": "en-Latn","source_language_name": "English","detection_confidence": 0.99,"inference_latency": 142,"output": {"kind": "single","single": {"translation": "Ouvrez un ticket d'assistance pour {name}.","src": "en-Latn","tgt": "fr-Latn"}},"usage": {"input_characters": 33,"output_characters": 42},"warnings": [],"quota": {"creditType": "premium","membership": "premium","monthlyCharacterQuota": 5000000,"monthlyCharacterUsage": 120033,"monthlyBillableCharacterUsage": 0,"perRequestCharacterLimit": null},"trial": {"isAuthenticated": true,"limit": null,"used": null,"remaining": null,"startedAt": null,"windowMs": null}}
Use one item in input.items for synchronous single translation. Root-level config keeps the public parser consistent with batch and async routes.
| Field | Type | Required | Description |
|---|---|---|---|
| request_id | string | Yes | Caller-provided trace ID returned in responses and logs. |
| src | language tag | "" | No | Root source language for the request. Use an empty string to auto-detect. |
| tgt | language tag | Yes | Root target language for the request. |
| content_mode | auto | plain | markdown | html | json | xml | yaml | csv | No | Structured content is preprocessed before translation. |
| split_input | 0 | 1 | 2 | No | 0 off, 1 balanced (default), 2 aggressive. Splitting can reduce latency with generally minimal impact on translation quality. |
| ps_context | string | No | Optional preceding-sentence context for short or ambiguous text. |
| metadata | object | No | Caller-defined JSON metadata echoed in logs and responses when present. |
| glossary_id | string | No | Stored glossary selection for this request. |
| glossary_version_id | string | No | Optional immutable stored glossary version for reproducible sync behavior. |
| glossary_group_ids | string[] | No | Selected enabled glossary groups. Combined with item selectors as a union. |
| glossary_item_ids | string[] | No | Selected enabled glossary items. Combined with group selectors as a union. |
| glossary.entries | array | No | Inline glossary mappings when you want request-scoped terminology instead of a stored glossary. |
| glossary.do_not_translate | string[] | No | Inline protected terms carried with the inline glossary. |
| do_not_translate | string[] | No | Top-level protected terms such as placeholders or brand names. |
| preserve_placeholders | boolean | No | Disabled by default. When true, the app detects placeholder-like patterns and adds them to protection rules without rewriting the source text. |
| strict_placeholder_preservation | boolean | No | Only applies when preserve_placeholders is true. Tightens enforcement when protected values are not preserved. |
| input.items | array(length = 1) | Yes | Native public single-translate requests use one item in the items array. |
| input.items[0].txt | string | Yes | Source text to translate. |
| Field | Type | Required | Description |
|---|---|---|---|
| ok | boolean | Yes | True for successful translate responses. |
| request_id | string | Yes | Echoes the caller request ID or a generated request ID. |
| operation | "translate" | Yes | Response operation discriminator. |
| output.kind | "single" | Yes | Single-output discriminator. |
| output.single.translation | string | Yes | Canonical translated text field. |
| output.single.src | string | No | Canonical source language tag for the returned translation. |
| output.single.tgt | string | No | Canonical target language tag for the returned translation. |
| source_language_tag | string | No | Canonical supplied or detected source language tag. |
| source_language_name | string | No | Human-readable source language name. |
| detection_confidence | number | null | No | Provider-backed detection confidence when available. |
| inference_latency | number | null | No | Provider-reported inference latency in milliseconds when available. |
| usage.input_characters | number | Yes | Characters counted from the request input. |
| usage.output_characters | number | Yes | Characters in translated output. |
| warnings | array | Yes | Non-fatal warnings such as preservation or confidence notes. |
| quota | object | null | No | Quota state returned for authenticated actors when available. |
| trial | object | null | No | Runtime quota-window state returned in the current response envelope. |
{"ok": false,"error": "Premium characters exhausted.","status": 429,"request_id": "req_translate_demo_001","quota": {"creditType": "premium","membership": "premium","monthlyCharacterQuota": 5000000,"monthlyCharacterUsage": 5000000,"monthlyBillableCharacterUsage": 0,"perRequestCharacterLimit": null}}
json and csv are preprocessed before translation. The provider sees extracted text segments, not your original structure.