import deeplauth_key = "{YOUR_API_KEY}" # replace with your keydeepl_client = deepl.DeepLClient(auth_key)result = deepl_client.translate_text("Hello, world!", target_lang="DE")print(result.text)
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
Install client library
npm install deepl-node
Sample request
import * as deepl from 'deepl-node';const authKey = "{YOUR_API_KEY}"; // replace with your keyconst deeplClient = new deepl.DeepLClient(authKey);(async () => { const result = await deeplClient.translateText('Hello, world!', null, 'de'); console.log(result.text);})();
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
Install client library
composer require deeplcom/deepl-php
Sample request
require_once 'vendor/autoload.php';use DeepL\Client;$authKey = "{YOUR_API_KEY}"; // replace with your key$deeplClient = new DeepL\DeepLClient($authKey);$result = $deeplClient->translateText('Hello, world!', null, 'de');echo $result->text;
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
Install client library
dotnet add package DeepL.net
Sample request
using DeepL; // this imports the DeepL namespace. Use the code below in your main program.var authKey = "{YOUR_API_KEY}"; // replace with your keyvar client = new DeepLClient(authKey);var translatedText = await client.TranslateTextAsync( "Hello, world!", null, LanguageCode.German);Console.WriteLine(translatedText);
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
Install client library
// For instructions on installing the DeepL Java library,// see https://github.com/DeepLcom/deepl-java?tab=readme-ov-file#installation
Sample request
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, "de"); System.out.println(result.getText()); }}
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
Install client library
gem install deepl-rb
Sample request
require 'deepl'DeepL.configure do |config| config.auth_key = '{YOUR_API_KEY}' # replace with your keyendtranslation = DeepL.translate 'Hello, world!', nil, 'de'puts translation.text
Sample output
Hallo, Welt!
In production code, it’s safer to store your API key in an environment variable.
3
Step 3: Keep building with our client libraries and how-to guides
DeepL 101 - A quick guide to text and document translation, using Postman to play with the API, client libraries for your favorite programming language, and joining our developer community