Actor picture

DeepL (AI translation) Actor


Receive high-quality translations from/to 24 languages using the DeepL API. It uses a proprietary algorithm with convolutional neural networks (CNNs) and translate far better than e.g. Google Translate. Free Tier is available.

No credit card required

Author's avatarTomas Kapler
  • Modified
  • Users7
  • Runs49
Actor picture
DeepL (AI translation) Actor


root = true

indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
end_of_line = lf


    "extends": "@apify"


# This file tells Git which files shouldn't be added to source control



# First, specify the base Docker image. You can read more about
# the available images at
# You can also use any other image from Docker Hub.
FROM apify/actor-node:16

# Second, copy just package.json and package-lock.json since it should be
# the only file that affects "npm install" in the next step, to speed up the build
COPY package*.json ./

# Install NPM packages, skip optional and development dependencies to
# keep the image small. Avoid logging too much and print the dependency
# tree for debugging
RUN npm --quiet set progress=false \
 && npm install --only=prod --no-optional \
 && echo "Installed NPM packages:" \
 && (npm list --all || true) \
 && echo "Node.js version:" \
 && node --version \
 && echo "NPM version:" \
 && npm --version

# Next, copy the remaining files and directories with the source code.
# Since we do this after NPM install, quick build will be really fast
# for most source file changes.
COPY . ./

# Optionally, specify how to launch the source code of your actor.
# By default, Apify's base Docker images define the CMD instruction
# that runs the Node.js source code using the command specified
# in the "scripts.start" section of the package.json file.
# In short, the instruction looks something like this:
# CMD npm start


    "title": "Input schema for the apify_project actor.",
    "type": "object",
    "schemaVersion": 1,
    "properties": {
        "auth_key": {
            "title": "Authentication Key",
            "type": "string",
            "description": "Authentication Key for DeepL API. You can find it here",
            "editor": "textfield"
        "text": {
            "title": "Source text",
            "type": "string",
            "description": "Text you want to translate",
            "editor": "textarea"
        "target_lang": {
            "title": "Target language",
            "type": "string",
            "editor": "select",
            "description": "The language (and variant) into which the text should be translated",
            "default": "EN-GB",
            "enum": ["BG", "CS", "DA", "DE", "EL", "EN-GB", "EN-US", "ES", "ET", "FI", "FR", "HU", "IT", "JA", "LT", "LV", "NL", "PL", "PT-PT", "PT-BR", "RO", "RU", "SK", "SL", "SV", "ZH"],
            "enumTitles": ["Bulgarian", "Czech", "Danish", "German", "Greek", "English (British)", "English (American)", "Spanish", "Estonian", "Finnish", "French", "Hungarian", "Italian", "Japanese", "Lithuanian", "Latvian", "Dutch", "Polish", "Portuguese (all Portuguese varieties excluding Brazilian Portuguese)", "Portuguese (Brazilian)", "Romanian", "Russian", "Slovak", "Slovenian", "Swedish", "Chinese"]
        "source_lang": {
            "title": "Source language",
            "type": "string",
            "editor": "select",
            "description": "Language of the text to be translated. Default is automatic detection.",
            "default": "",
            "enum": ["", "BG", "CS", "DA", "DE", "EL", "EN", "ES", "ET", "FI", "FR", "HU", "IT", "JA", "LT", "LV", "NL", "PL", "PT", "RO", "RU", "SK", "SL", "SV", "ZH"],
            "enumTitles": ["Autodetect","Bulgarian", "Czech", "Danish", "German", "Greek", "English", "Spanish", "Estonian", "Finnish", "French", "Hungarian", "Italian", "Japanese", "Lithuanian", "Latvian", "Dutch", "Polish", "Portuguese (all Portuguese varieties mixed)", "Romanian", "Russian", "Slovak", "Slovenian", "Swedish", "Chinese"]
        "split_sentences": {
            "title": "Split sentences",
            "type": "string",
            "description": "Sets whether the translation engine should first split the input into sentences. This is enabled by default.<br />For applications that send one sentence per text parameter, it is advisable to set split_sentences=0, in order to prevent the engine from splitting the sentence unintentionally.",
            "editor": "select",
            "default": "1",
            "enum": ["0", "1", "nonewlines"],
            "enumTitles": ["0 - no splitting at all, whole input is treated as one sentence","1 - (default) - splits on punctuation and on newlines","nonewlines - splits on punctuation only, ignoring newlines"]
        "preserve_formatting": {
            "title": "Preserve formatting",
            "type": "string",
            "description": "Sets whether the translation engine should respect the original formatting, even if it would usually correct some aspects. <br />The formatting aspects affected by this setting include:<br />-Punctuation at the beginning and end of the sentence<br />-Upper/lower case at the beginning of the sentence",
            "editor": "select",
            "default": "0",
            "enum": ["0", "1"],
            "enumTitles": ["0 (default) - No, do not preserver formatting","1 - Yes, preserve formatting"]
        "formality": {
            "title": "Formality",
            "type": "string",
            "description": "Sets whether the translated text should lean towards formal or informal language. This feature currently only works for target languages 'DE' (German), 'FR' (French), 'IT' (Italian), 'ES' (Spanish), 'NL' (Dutch), 'PL' (Polish), 'PT-PT', 'PT-BR' (Portuguese) and 'RU' (Russian).",
            "editor": "select",
            "default": "default",
            "enum": ["default", "more", "less"],
            "enumTitles": ["Default","More","Less"]
        "glossary_id": {
            "title": "Glossary ID",
            "type": "string",
            "description": "Specify the glossary to use for the translation. Important: This requires the source_lang parameter to be set and the language pair of the glossary has to match the language pair of the request.",
            "editor": "textfield",
            "nullable": true
    "required": ["text","auth_key"]

# DeepL (AI translation) Actor

Receive high-quality translations from/to 24 languages using the [DeepL](

This Apify Actor use [DeepL API]( 
to provide you high-quality translations based on advanced ML.

*You must have the DeepL Authentication Key. 
You can [Sign up for free]( 
and recieve free credit for 500,000 characters limit a month.
The key you will then find in your [Account Summary page](

## Input properties

There are 3 key input properties
- auth_key - Authentication Key (see above)
- text - text to be translated
- target language - one of 24 languages + 2 variants

Details about the other properties you can find under the (?) help icon, in INPUT_SCHEMA.json and 
in [DeepL API Docs request section](


    "env": { "npm_config_loglevel": "silent" }


// This is the main Node.js source code file of your actor.

// Import Apify SDK. For more information, see
const Apify = require('apify');
// Import Got, see
const got = require('got');

Apify.main(async () => {
    // Get input of the actor (here only for demonstration purposes).
    const input = await Apify.getInput();
    const auth_key = input.auth_key;
    console.log('Glossary ID:');

     * Actor code
    const {body} = await''+auth_key, {
        form: {
            text: input.text,
            source_lang: input.source_lang,
            target_lang: input.target_lang,
            split_sentences: input.split_sentences,
            preserve_formatting: input.preserve_formatting,
            formality: input.formality/*,
            glossary_id: input.glossary_id*/
        responseType: 'json'

    await Apify.setValue('OUTPUT', body);
    body.translations[0].source = input.text;
    await Apify.pushData(body.translations[0]);



    "name": "project-empty",
    "version": "0.0.1",
    "description": "This is a boilerplate of an Apify actor.",
    "dependencies": {
        "apify": "^2.0.7",
        "got": "latest"
    "devDependencies": {
        "@apify/eslint-config": "^0.1.3",
        "eslint": "^7.0.0"
    "scripts": {
        "start": "node main.js",
        "lint": "./node_modules/.bin/eslint ./src --ext .js,.jsx",
        "lint:fix": "./node_modules/.bin/eslint ./src --ext .js,.jsx --fix",
        "test": "echo \"Error: oops, the actor has no tests yet, sad!\" && exit 1"
    "author": "It's not you it's me",
    "license": "ISC"