About translation memories
Translation memories store and reuse previously created translations. When you translate with a translation memory, your source text is compared against the translation memory’s segments. If a segment is similar enough, the stored translation is applied instead of generating a new one.What you’ll learn
In this tutorial, we’ll retrieve the translation memories on your account, use one in a translation request, and adjust the matching threshold to control how closely source text must match a stored segment.Before you begin
You’ll need:- A DeepL API authentication key
- At least one translation memory uploaded to your account via the DeepL UI
- A terminal or HTTP client for making API requests
- Approximately 10 minutes
Example translation memory
In this tutorial, we’ll use a translation memory called “Greetings” that contains German-to-English translations. One of its segments looks like this:| Source (DE) | Translation (EN) |
|---|---|
| Hallo Welt! | Hello everyone! |
Step 1: List your translation memories
First, let’s retrieve the translation memories on your account so we can find the one we want to use.translation_memory_id — this is what we’ll pass to the translate endpoint. Also note the source_language and target_languages fields, which tell us this translation memory translates from German to English.
If you see an empty list, make sure you’ve uploaded at least one translation memory via the DeepL translation memory page.
Step 2: Translate text with a translation memory
Now let’s use that translation memory in a translation request. Add thetranslation_memory_id parameter to your call to the text translation endpoint.
source_lang — language auto-detection still works when using a translation memory.
Step 3: Adjust the matching threshold
By default, a stored segment is applied when it matches at least 75% of the source text. This means translation memory segments can match even when the source text isn’t identical — which is useful for catching typos and minor variations. Let’s see this in action. Imagine we make a typo and send “Halloo Welt!” instead of “Hallo Welt!”:75, “Halloo Welt!” is close enough to “Hallo Welt!” that the translation memory segment still applies, and we get our custom translation “Hello everyone!”.
Now let’s raise the threshold to 100 so only exact matches are used:
100, “Halloo Welt!” is no longer an exact match for “Hallo Welt!”, so the translation memory segment is not applied. DeepL falls back to its default translation: “Hello world!”.
What you’ve accomplished
You’ve learned how to:- Retrieve the translation memories on your account
- Use a translation memory in a translation request
- Control the matching threshold to tune how closely source text must match a stored segment
See also
- List translation memories — API reference
- Text translation endpoint —
translation_memory_idandtranslation_memory_thresholdparameter reference - Supported languages — check which languages support translation memories