Documentation Index
Fetch the complete documentation index at: https://deepl-c950b784-update-create-free-api-account-link.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Once you’ve created a DeepL API account and located your authentication key, you’re ready to make your first requests.
Text translation
To translate text, you can use the /translate endpoint, which also supports translation of XML and HTML content.
We included text translation examples for our client libraries, too, just to give you an idea of what they look like.
HTTP Request
cURL
Python
JavaScript
PHP
C#
Java
Ruby
If you chose a free API plan, replace https://api.deepl.com with https://api-free.deepl.com.
POST /v2/translate HTTP/2
Host: api.deepl.com
Authorization: DeepL-Auth-Key [yourAuthKey]
User-Agent: YourApp/1.2.3
Content-Length: 45
Content-Type: application/json
{"text":["Hello, world!"],"target_lang":"DE"}
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}
If you chose a free API plan, replace https://api.deepl.com with https://api-free.deepl.com.
curl -X POST 'https://api.deepl.com/v2/translate' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
"text": [
"Hello, world!"
],
"target_lang": "DE"
}'
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}
import deepl
auth_key = "f63c02c5-f056-..." # replace with your key
deepl_client = deepl.DeepLClient(auth_key)
result = deepl_client.translate_text("Hello, world!", target_lang="FR")
print(result.text) # "Bonjour à tous !"
In production code, it’s safer to store your API key in an environment variable.
import * as deepl from 'deepl-node';
const authKey = "f63c02c5-f056-..."; // Replace with your key
const deeplClient = new deepl.DeepLClient(authKey);
(async () => {
const result = await deeplClient.translateText('Hello, world!', null, 'fr');
console.log(result.text); // Bonjour à tous !
})();
In production code, it’s safer to store your API key in an environment variable.
require_once 'vendor/autoload.php';
use DeepL\Translator;
$authKey = "f63c02c5-f056-..."; // Replace with your key
$deeplClient = new \DeepL\DeepLClient($authKey);
$result = $deeplClient->translateText('Hello, world!', null, 'fr');
echo $result->text; // Bonjour, le monde!
In production code, it’s safer to store your API key in an environment variable.
using DeepL; // this imports the DeepL namespace. Use the code below in your main program.
var authKey = "f63c02c5-f056-..."; // replace with your key
var client = new DeepLClient(authKey);
var translatedText = await client.TranslateTextAsync(
"Hello, world!",
null,
LanguageCode.French);
Console.WriteLine(translatedText); // "Bonjour à tous !"
In production code, it’s safer to store your API key in an environment variable.
import com.deepl.api.*;
public class Main {
public static void main(String[] args) throws DeepLException, InterruptedException {
String authKey = "{YOUR_API_KEY}"; // replace with your key
DeepLClient client = new DeepLClient(authKey);
TextResult result = client.translateText("Hello, world!", null, "fr");
System.out.println(result.getText()); // "Bonjour à tous !"
}
}
In production code, it’s safer to store your API key in an environment variable.
require 'deepl'
DeepL.configure do |config|
config.auth_key = '{YOUR_API_KEY}' # replace with your key
end
translation = DeepL.translate 'Hello, world!', nil, 'fr'
puts translation.text // "Bonjour à tous !"
In production code, it’s safer to store your API key in an environment variable.
Text improvement
To improve text, you can use the /write/rephrase endpoint. We included an example below.
The text improvement endpoint (DeepL API for Write) is currently only available to Pro API subscribers via the v2 endpoint.
Write API example: cURL
curl -X POST 'https://api.deepl.com/v2/write/rephrase' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
"text": [
"Its never to late too fix you'\''re grammer & speling!"
],
"target_lang": "en-GB"
}'
{
"improvements": [
{
"text": "It's never too late to fix your grammar and spelling!",
"detected_source_language": "en",
"target_language": "en-GB"
}
]
}