How do I get my DeepL API key and make my first /translate request?
Language Translation AI

How do I get my DeepL API key and make my first /translate request?

8 min read

Most teams reach DeepL’s API documentation with the same two questions: where do I get my DeepL API key, and what’s the fastest path to a working /translate call? Let’s walk through the end‑to‑end setup—from choosing the right plan to sending your first request in just a few minutes.

This guide assumes you want to integrate DeepL Translator into your product, internal tools, or localization workflow using the DeepL API.


Step 1: Choose the right DeepL API plan

Before you can get a DeepL API key, you need the right subscription. Not every DeepL product includes API access.

DeepL API vs. other DeepL products

DeepL offers several products—DeepL Translator web/app, DeepL Write, DeepL Voice for Meetings, DeepL Agent, and DeepL API. For programmatic access, you specifically need:

  • DeepL API Free – best for:
    • Development, testing, and prototypes
    • Low-volume automation (e.g., simple internal tools)
  • DeepL API Pro – best for:
    • Production workloads and customer-facing features
    • High-volume translation of text and documents
    • Regulated or sensitive data (Pro content is not used for training and is deleted after processing)

If you currently only use the web translator or desktop/mobile apps, that does not automatically include API access—you still need a DeepL API plan.

How to sign up for DeepL API

  1. Go to: https://www.deepl.com/en/pro#developer (or navigate via Products → API).
  2. Select DeepL API Free or DeepL API Pro.
  3. Create or sign in to your DeepL account.
  4. Complete the subscription steps:
    • For Free: confirm your email and basic details.
    • For Pro: add billing information and finalize the plan.

Once that’s done, you can access your API key from the account dashboard.


Step 2: Find your DeepL API key

Your API key is the credential that lets your code authenticate with the DeepL translation endpoint. Treat it like a password—never commit it to public repositories or share it in screenshots.

Where to locate the API key

  1. Sign in to your DeepL account at https://www.deepl.com/account.
  2. Go to the API or Developer section (label may vary slightly by account view).
  3. Locate your Authentication key or API key (a long alphanumeric string).

You’ll typically see:

  • The auth key (e.g., xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx:fx)
  • The API URL to use for requests, often shown right alongside it

Copy the key and store it securely (e.g., in a password manager or your infrastructure’s secrets manager).


Step 3: Set up your API environment securely

Before you make your first /translate request, configure a minimal, secure environment. From an enterprise perspective, this is where you avoid the “demo” trap and align with your security and compliance expectations.

Use environment variables, not hardcoded keys

For local development, create an environment variable:

macOS/Linux (bash/zsh):

export DEEPL_API_KEY="your-auth-key-here"

Windows (PowerShell):

setx DEEPL_API_KEY "your-auth-key-here"

Then, in your application code, read the key from the environment rather than pasting it into the source:

echo $DEEPL_API_KEY  # macOS/Linux

or

echo $Env:DEEPL_API_KEY  # Windows

In production, use your standard secrets management approach (e.g., AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault, Kubernetes Secrets) and role-based access so you can:

  • Rotate keys without code changes
  • Restrict who can read or modify them
  • Audit access in line with your ISO 27001/SOC 2 controls

Step 4: Understand the DeepL /translate endpoint

DeepL API provides a REST endpoint for translating text. The essentials:

  • HTTP Method: POST
  • Endpoint: (region-specific; your account page will show the exact one)
    • Commonly: https://api.deepl.com/v2/translate
    • For some Free plans: https://api-free.deepl.com/v2/translate
  • Authentication: API key via header or query parameter
  • Parameters (body or query):
    • text (required; one or more strings to translate)
    • target_lang (required; language code, e.g., EN-US, DE, FR)
    • source_lang (optional; DeepL can auto-detect if omitted)
    • Additional controls (optional), such as formality and glossaries (beyond the scope of this first request, but critical for terminology governance later)

For your first call, you only need text and target_lang plus your authentication.


Step 5: Make your first /translate request from the command line

If you want the fastest way to confirm everything works, use curl. This keeps your test lightweight and free of framework issues.

Example: Basic /translate request with curl

curl https://api.deepl.com/v2/translate \
  -H "Authorization: DeepL-Auth-Key $DEEPL_API_KEY" \
  -d "text=Hello, world!" \
  -d "target_lang=DE"

What’s happening here:

  • Authorization: DeepL-Auth-Key ... – passes your API key securely in the header
  • text=Hello, world! – the content you want to translate
  • target_lang=DE – tells DeepL to translate into German

You should receive a JSON response similar to:

{
  "translations": [
    {
      "detected_source_language": "EN",
      "text": "Hallo, Welt!"
    }
  ]
}

If you see a response like this, your key is valid and the /translate endpoint is working.


Step 6: Make your first /translate request in your preferred language (code examples)

Once curl works, move into your application stack. Below are minimal examples in a few common languages. In all of them, the same pattern applies:

  • Read the API key from an environment variable
  • Call https://api.deepl.com/v2/translate (or your specific endpoint)
  • POST text and target_lang
  • Parse the JSON response

Python example

import os
import requests

DEEPL_API_KEY = os.getenv("DEEPL_API_KEY")
if not DEEPL_API_KEY:
    raise RuntimeError("DEEPL_API_KEY not set")

url = "https://api.deepl.com/v2/translate"
data = {
    "text": "Hello, world!",
    "target_lang": "DE"
}

headers = {
    "Authorization": f"DeepL-Auth-Key {DEEPL_API_KEY}"
}

response = requests.post(url, data=data, headers=headers)
response.raise_for_status()

result = response.json()
translated_text = result["translations"][0]["text"]
print("Translated:", translated_text)

JavaScript (Node.js) example (using fetch)

import 'dotenv/config'; // if using dotenv, optional
import fetch from 'node-fetch';

const apiKey = process.env.DEEPL_API_KEY;
if (!apiKey) {
  throw new Error('DEEPL_API_KEY not set');
}

const url = 'https://api.deepl.com/v2/translate';

const params = new URLSearchParams();
params.append('text', 'Hello, world!');
params.append('target_lang', 'DE');

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Authorization': `DeepL-Auth-Key ${apiKey}`,
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  body: params.toString()
});

if (!response.ok) {
  console.error('Error:', await response.text());
  throw new Error(`HTTP error ${response.status}`);
}

const result = await response.json();
const translatedText = result.translations[0].text;
console.log('Translated:', translatedText);

cURL with query-parameter authentication (alternative style)

If you prefer, you can authenticate via query param instead of header—useful for quick tests but not ideal for production logging hygiene:

curl "https://api.deepl.com/v2/translate?auth_key=$DEEPL_API_KEY" \
  -d "text=Hello, world!" \
  -d "target_lang=DE"

For enterprise environments with strict logging and monitoring, I strongly recommend the header-based approach so your key is less likely to appear in URL logs or metrics tools.


Step 7: Handle errors and rate limits from the start

Even for your first /translate request, it’s worth wiring in basic error handling. DeepL API returns standard HTTP status codes; common situations include:

  • 401 Unauthorized – invalid or missing API key
    • Check that Authorization: DeepL-Auth-Key ... is set
    • Confirm you’re using the correct endpoint (Free vs Pro)
  • 403 Forbidden – account issue or plan restriction
    • Verify your subscription is active and supports the call volume
  • 429 Too Many Requests – you’re hitting rate or usage limits
    • Back off and retry with exponential delay
    • Consider upgrading to DeepL API Pro for higher throughput
  • 456 Quota Exceeded (for some plans) – your monthly character quota is exhausted

For production workflows, implement:

  • Retry logic with sensible limits
  • Alerts when you approach quota thresholds
  • Logging that captures status, error messages, and correlation IDs, but never logs raw API keys or sensitive translated content unless strictly necessary and protected

Step 8: Move beyond “hello world” with translation controls

Once your first /translate call works, you can start aligning translations with your terminology and brand voice—this is where DeepL API becomes enterprise-grade rather than just a machine translation endpoint.

Key controls to explore next:

  • Glossaries: enforce product names, legal phrases, and domain-specific terms across all translations
  • Formality: choose between more formal or informal tone in supported languages
  • Tag handling and document translation: keep HTML or XML structure intact, or translate entire documents while preserving layout and visual context

These are configured via additional parameters and endpoints in the API and mirror what you can control in DeepL Translator and DeepL Write. They’re essential if you need consistent wording across support, legal, product, and marketing in 100+ languages.


Troubleshooting: common pitfalls when making your first /translate request

If something doesn’t work on the first try, check:

  1. Plan type mismatch
    • Are you using a generic DeepL Pro subscription instead of DeepL API? Only the API plans provide an auth key for /translate.
  2. Wrong endpoint
    • Free plans often use api-free.deepl.com; Pro plans use api.deepl.com. Your account page explicitly shows the correct base URL.
  3. Missing or misformatted auth header
    • It must be: Authorization: DeepL-Auth-Key YOUR_KEY
    • No extra spaces or missing prefix.
  4. Encoding issues
    • When sending non-ASCII characters, ensure your client handles UTF-8 correctly.
    • Use application/x-www-form-urlencoded or JSON as documented, not a custom content type.
  5. Network/firewall constraints
    • In corporate environments, confirm that outbound connections to api.deepl.com (or api-free.deepl.com) over HTTPS (port 443) are allowed.

From first request to real-world integration

Once you’ve made your first /translate request, you’re ready to:

  • Automate translation of internal tools (ticketing systems, knowledge bases, CRM fields)
  • Add multilingual capabilities to customer-facing products
  • Connect DeepL API into existing localization pipelines and CAT tools
  • Combine DeepL Translator with DeepL Write and DeepL Agent to streamline multilingual drafting, editing, and automation

The key is to move from “I can call /translate” to “I can reliably govern translation quality, terminology, and security at scale.” That’s where DeepL’s specialized LLM, glossaries, formality options, and enterprise controls (SSO/MFA, audit logs, GDPR-aligned data handling) come together.

If you’re planning a larger rollout or need to align DeepL API with your security and compliance requirements, it’s usually worth a short scoping conversation with DeepL’s team.

Get Started