Make your first API request and translate text with the DeepL API.
Once you've created a DeepL API account and located your authentication key, you're ready to make your first request. Let's start with text translation.
We included text translation examples for our client libraries, too, just to give you an idea of what they look like.
The example below uses our API Pro endpoint https://api.deepl.com. If you're an API Free user, remember to update your requests to use https://api-free.deepl.com instead.
The example below uses our API Pro endpoint https://api.deepl.com. If you're an API Free user, remember to update your requests to use https://api-free.deepl.com instead.
POST /v2/translate HTTP/2Host:api.deepl.comAuthorization:DeepL-Auth-Key [yourAuthKey]User-Agent:YourApp/1.2.3Content-Length:45Content-Type:application/json{"text":["Hello, world!"],"target_lang":"DE"}
import deeplauth_key ="f63c02c5-f056-..."# Replace with your keytranslator = deepl.Translator(auth_key)result = translator.translate_text("Hello, world!", target_lang="FR")print(result.text)# "Bonjour, le monde !"
$authKey ="f63c02c5-f056-..."; // Replace with your key$translator =new\DeepL\Translator($authKey);$result = $translator->translateText('Hello, world!',null,'fr');echo $result->text; // Bonjour, le monde!
var authKey ="f63c02c5-f056-..."; // Replace with your keyvar translator =newTranslator(authKey);// Translate text into a target language, in this case, French:var translatedText =awaittranslator.TranslateTextAsync("Hello, world!",LanguageCode.English,LanguageCode.French);Console.WriteLine(translatedText); // "Bonjour, le monde !"// Note: printing or converting the result to a string uses the output text.
import*as deepl from'deepl-node';constauthKey="f63c02c5-f056-..."; // Replace with your keyconsttranslator=newdeepl.Translator(authKey);(async () => {constresult=awaittranslator.translateText('Hello, world!',null,'fr');console.log(result.text); // Bonjour, le monde !})();
importcom.deepl.api.*;classExample {Translator translator;publicExample() throwsException {String authKey ="f63c02c5-f056-..."; // Replace with your key translator =newTranslator(authKey);TextResult result =translator.translateText("Hello, world!",null,"fr");System.out.println(result.getText()); // "Bonjour, le monde !" }}