1. Sign Up for API Access
Go to the Developer Platform and create a free account. After signing up, generate an API key from the dashboard. Free accounts come with 500,000 characters per month at no charge.
You'll need to include your API key in every request via the Authorization header:
Authorization: DeepL-Auth-Key YOUR_API_KEY
2. HTTP Request
All API requests use HTTP POST to the base URL:
https://api-free.deepl.com/v2/translate (Free) https://api.deepl.com/v2/translate (Pro/Enterprise)
The text and target_lang parameters are required. All other parameters are optional.
3. cURL Example
Send a text translation request directly from the command line:
curl -X POST 'https://api-free.deepl.com/v2/translate' \
-H 'Authorization: DeepL-Auth-Key YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"text": ["Hello, world!"],
"target_lang": "DE"
}'
4. Python
Install the official Python client library:
pip install deepl
Usage example:
import deepl
translator = deepl.Translator("YOUR_API_KEY")
result = translator.translate_text("Hello, world!", target_lang="DE")
print(result.text) # "Hallo, Welt!"
For detailed Python API reference, see the SDKs page.
5. JavaScript / Node.js
Install the official Node.js client library:
npm install deepl-node
Usage example:
const deepl = require('deepl-node');
const translator = new deepl.Translator('YOUR_API_KEY');
const result = await translator.translateText('Hello, world!', null, 'DE');
console.log(result.text); // "Hallo, Welt!"
6. PHP
Install the official PHP client library:
composer require deeplcom/deepl-php
Usage example:
$translator = new \DeepL\Translator('YOUR_API_KEY');
$result = $translator->translateText('Hello, world!', null, 'DE');
echo $result->text; // "Hallo, Welt!"
7. C# / .NET
Install the official .NET client library:
dotnet add package DeepL.net
Usage example:
using DeepL;
var translator = new Translator("YOUR_API_KEY");
var result = await translator.TranslateTextAsync("Hello, world!", null, "DE");
Console.WriteLine(result.Text); // "Hallo, Welt!"
8. Java
Add the dependency (Maven):
implementation 'com.deepl.api:deepl-java:1.7.0'
Usage example:
import com.deepl.api.*;
Translator translator = new Translator("YOUR_API_KEY");
TextResult result = translator.translateText("Hello, world!", null, "DE");
System.out.println(result.getText()); // "Hallo, Welt!"
9. Ruby
Add to Gemfile:
gem 'deepl-rb'
Usage example:
require 'deepl'
DeepL.configure do |config|
config.auth_key = 'YOUR_API_KEY'
end
result = DeepL.translate('Hello, world!', nil, 'DE')
puts result.text # "Hallo, Welt!"
10. Next Steps
- Explore the full Translate Text API reference for all parameters and options.
- Learn about Document Translation for translating files.
- Check out SDKs & Client Libraries for more language support.
- Read the official DeepL API Reference for complete details.