Translation Memory
Overview
Translation Memory (TM) stores every translation you make and automatically reuses exact matches. When you translate the same text again with the same language pair, the stored translation is returned instantly at no cost.
TM is per-account. Each account has its own isolated translation memory.
Enabling Translation Memory
Add translationMemory: true to your translate request:
{
"q": "Hello world",
"target": "nl",
"translationMemory": true
}
Default behavior:
- API requests: TM is off by default (backwards compatibility)
- To enable, set
translationMemory: trueexplicitly
How it works
- You send a translation request with
translationMemory: true - Langbly checks your TM for an exact match (same source text, same language pair)
- Hit: stored translation is returned. No processing, no billing.
- Miss: text is translated normally. The result is saved to your TM for future reuse.
Billing
TM hits are free. Only new translations (TM misses) count toward your usage.
This means your effective cost decreases over time as your TM fills up with frequently used translations.
Limits
- Maximum 100,000 entries per account
- When the limit is reached, the oldest entries are automatically removed (FIFO)
API endpoints
Get TM statistics
GET /v2/translation-memory/stats
Response:
{
"data": {
"totalEntries": 1523,
"totalHits": 4891,
"languagePairs": [
{ "sourceLang": "en", "targetLang": "nl", "entryCount": 1200 },
{ "sourceLang": "en", "targetLang": "de", "entryCount": 323 }
]
}
}
Delete TM entries
Delete all entries:
DELETE /v2/translation-memory
Delete a specific language pair:
DELETE /v2/translation-memory?sourceLang=en&targetLang=nl
Response:
{
"deleted": 1200
}
Export TM entries
Retrieve your stored TM entries as JSON. Useful for backup or migrating to another system.
GET /v2/translation-memory/entries
Query parameters (all optional):
| Parameter | Type | Description |
|---|---|---|
sourceLang | string | Filter by source language code (e.g. en) |
targetLang | string | Filter by target language code (e.g. nl) |
limit | number | Max entries to return (default and max: 50,000) |
Example:
curl "https://api.langbly.com/v2/translation-memory/entries?sourceLang=en&targetLang=nl" \
-H "X-API-Key: YOUR_API_KEY"
Response:
{
"data": {
"entries": [
{
"sourceText": "Hello world",
"targetText": "Hallo wereld",
"sourceLang": "en",
"targetLang": "nl"
}
],
"count": 1
}
}
You can convert the JSON output to TMX (Translation Memory eXchange) format for use in other translation tools.
Import TM entries
Bulk import entries into your translation memory. Duplicate entries (same source text and language pair) are updated with the new target text.
POST /v2/translation-memory/import
Request body:
{
"entries": [
{
"sourceText": "Hello world",
"targetText": "Hallo wereld",
"sourceLang": "en",
"targetLang": "nl"
},
{
"sourceText": "Good morning",
"targetText": "Goedemorgen",
"sourceLang": "en",
"targetLang": "nl"
}
]
}
Entry fields:
| Field | Type | Required | Description |
|---|---|---|---|
sourceText | string | Yes | The original text |
targetText | string | Yes | The translation |
sourceLang | string | Yes | Source language code |
targetLang | string | Yes | Target language code |
Response:
{
"data": {
"imported": 2
}
}
Limits: Maximum 50,000 entries per import request. Entries with empty fields are silently skipped.
Best practices
- Enable TM for repetitive content: UI strings, product descriptions, support templates
- TM works best with consistent source text. Small changes (capitalization, punctuation) create separate entries
- Combine TM with glossaries for consistent terminology across all translations