I authored an article on DeepL API for Nikkei Software Magazine. In the article, I introduced DeepL API with a sample ORC application which I built. Here on this blog, I’m going to introduce how to start DeepL API.
What is DeepL?
DeepL was released in the summer of 2017 by a German company that develops artificial intelligence systems for languages, based on deep learning. The accuracy of the translation and the naturalness of the translation like never before!
I personally work in a multinational environment, and this has helped me greatly with specification coordination work for specifications written in Japan, though some complicated business logic can not be translated pretty well.
For API, DeepL Account is required
If you want to use DeepL API, you have to create DeepL API account in order to get api key first of all. DeepL offers both free and paid plans, and for personal use, the free plan is fine. Even with the free plan, you can translate 500,000 words per month for free, and if you use up your free quota, you will receive a 456 status back, so there is no need to worry about being charged.
API specification
The DeepL API provides a good documentation and a simulator. Note that translations in the simulator are also counted as characters in the free plan.
Translate API
According to the document, we can translate texts like a request below.
curl -X POST 'https://api-free.deepl.com/v2/translate' \
--header 'Authorization: DeepL-Auth-Key [yourAuthKey]' \
--header 'Content-Type: application/json' \
--data '{
"text": [
"Hello, world!"
],
"target_lang": "DE"
}'
As you see the request, header contains auth key. If we use this in a web application for example, we have to request this API though our backend api in order to hide it instead of requesting directly from the browser
The response will be ↓
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}