New user? Follow these quick steps to get started with the DeepL API.
Step 2: Test your API key with a request.
Here are a few simple options that you can start with. Choose any one, making sure to replace {YOUR_API_KEY}
with the API key you just obtained.
If you signed up for a free API account, replace https://api.deepl.com
with https://api-free.deepl.com
.
Open a terminal. Then:
export API_KEY={YOUR_API_KEY}
curl -X POST https://api.deepl.com/v2/translate \
--header "Content-Type: application/json" \
--header "Authorization: DeepL-Auth-Key $API_KEY" \
--data '{
"text": ["Hello world!"],
"target_lang": "DE"
}'
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}
Choose a local directory to work in. Then:
import deepl
auth_key = "{YOUR_API_KEY}"
translator = deepl.Translator(auth_key)
result = translator.translate_text("Hello, world!", target_lang="DE")
print(result.text)
Choose a local directory to work in. Then:
npm install deepl-node
import * as deepl from 'deepl-node';
const authKey = "{YOUR_API_KEY}";
const translator = new deepl.Translator(authKey);
(async () => {
const result = await translator.translateText('Hello, world!', null, 'de');
console.log(result.text);
})();
Step 3: Keep building with our client libraries and how-to guides.