EMZETT.
Login

DeepL API

In short: A translation API that lets you translate texts programmatically from one language into another — known for translations that sound noticeably more natural than many alternatives.

In more detail: Runs with an API key (DEEPL_API_KEY); the free “API Free” plan is enough for smaller projects. A practical pattern: if the key is missing, the code falls back cleanly to the source language instead of crashing — just like with other optional services (e.g. Cloudflare Turnstile, Pusher).

Our context: At Emzett it automatically translates content that next-intl doesn’t cover (because next-intl can only handle hard-coded UI texts, not database content) — news articles, newsletter emails and push notifications are automatically translated into English when saved and delivered to each recipient in their stored language.

In Depth

Machine translation can be roughly divided into two generations: older statistical/rule-based systems that translate word by word or based on large statistics of translation pairs, and newer systems based on neural networks (deep learning) that look at whole sentences in context. DeepL belongs to the second generation, founded in 2017 out of the language-learning company Linguee — the huge collection of human-translated sentence pairs gathered by Linguee over the years supplied exactly the training data a neural translation model needs. DeepL is deliberately specialised in translation quality, unlike a general-purpose language model (e.g. GPT or Claude), which masters translation only “on the side” as one of many abilities — in blind tests, DeepL regularly does better than Google Translate for many language pairs, especially within Europe, above all with idiomatic expressions and word order.

API parameters and formality

Practically relevant for the integration: the API distinguishes between the source language (optional; if omitted it’s determined automatically via language detection) and the target language (mandatory), and offers a formality parameter for languages with a formal/informal “you” distinction (German, French and others) — handy for business communication that should consistently use the formal form even if the source material was worded more informally. A common stumbling block is HTML/Markdown formatting in the text — without special handling, the API also translates content inside tags or changes Markdown syntax, which can destroy formatting; for this the API offers a tag_handling mode ("html" or "xml") that leaves certain tags structurally untouched during translation and only transfers the text content between them.

const result = await fetch("https://api-free.deepl.com/v2/translate", {
  method: "POST",
  headers: { Authorization: `DeepL-Auth-Key ${process.env.DEEPL_API_KEY}` },
  body: new URLSearchParams({ text, target_lang: "EN", formality: "more" }),
})

Fallback strategy and limits

A robust integration pattern consistently treats DeepL as an optional improvement, not a hard dependency: if the API key is missing, the request fails, or the quota of the free “API Free” plan (500,000 characters/month) is used up, the application should fall back cleanly to the source language instead of crashing completely — the same pattern as with other optional services (e.g. Cloudflare Turnstile, Pusher). It’s also important that machine translation of legally binding or particularly sensitive texts (terms and conditions, medical content) should always be checked by a human — DeepL is good, but not error-free, and translation errors in legal texts can have real consequences.

Compared with the alternatives

Google Cloud Translation covers far more languages (over 100 compared to DeepL’s roughly 30), but tends to be less natural in its wording for European language pairs. Microsoft Translator scores with good integration into the Microsoft ecosystem (Office, Azure). For a project that primarily translates between European languages and values natural-sounding results, DeepL is usually the better choice; for very many or exotic language pairs (e.g. German–Swahili), Google often offers the only practical coverage.

See also: next-intl, API