API
POST /v1/translate
Translate a piece of text with your account's settings and language assets. The core endpoint of the API.
Send text and a target language; receive the translation. Your account's translation memory can be reused automatically, and glossary enforcement applies just as in the workspace.
Request
curl -X POST https://www.deepreference.com/api/v1/translate \
-H "Authorization: Bearer dr_your_key_here" \
-H "Content-Type: application/json" \
-d '{
"text": "The agreement enters into force upon signature.",
"target_lang": "de",
"domain": "legal",
"tone": "formal"
}'| Field | Type | Default | Description |
|---|---|---|---|
| text | string | required | The text to translate, up to 20,000 characters. |
| target_lang | string | required | Target language code, e.g. "de", "fr", "zh". |
| source_lang | string | "auto" | Source language code, or "auto" to detect it. |
| domain | string | "general" | One of the 13 domains (see Domains). |
| mode | string | "natural" | "natural" or "literal" (see Tone and mode). |
| tone | string | "standard" | The tone of the result (see Tone and mode). |
| use_tm | boolean | true | Reuse your translation memory for exact matches. |
Response
{
"translation": "Die Vereinbarung tritt mit der Unterzeichnung in Kraft.",
"source_lang": "en",
"target_lang": "de",
"billable_words": 9,
"tm_match": false
}| Field | Meaning |
|---|---|
| translation | The translated text. |
| source_lang | The detected or provided source language. |
| target_lang | The target language of the result. |
| billable_words | Words charged for this request: the visible words of the result. |
| tm_match | true if the result came from your translation memory instead of fresh generation. |
Sending the same text twice with use_tm enabled? The second call returns your stored translation: consistent, fast, and marked with tm_match: true.
Errors
- 401: missing or invalid API key. The response tells you which header formats are accepted.
- 403: the key's account plan does not include API access, or the key lacks the translate scope.
- 422: invalid parameters (empty text, unknown field values, text over the length limit).
- 429 / quota errors: your monthly word allowance is exhausted; check /v1/usage.
Keep exploring
API overview and authentication
REST endpoints for Business and Enterprise accounts to translate text and read current word usage with API-key authentication.
GET /v1/usage
Read the used, limit, and remaining word counts for the current billing period.
Tone and mode
Mode controls how closely the translation follows the source structure (natural vs. literal). Tone controls the register of the result: nine tones on top of the standard voice.
Domains
Twelve specialized domains (legal, medical, financial, technical and more) steer the model toward the vocabulary and conventions of your field.