Getting started overview
Integrating DeepL into an application or workflow typically involves a sequence of steps:
- Account Creation: Register for a DeepL API account, choosing either the Free or Pro tier.
- API Key Retrieval: Locate and securely store the unique authentication key provided in your DeepL account dashboard.
- Environment Setup: Install any necessary SDKs or configure your development environment to make HTTP requests.
- First Request: Execute a basic text translation request to confirm that your API key is valid and your setup is correct.
- Error Handling: Implement basic error handling to manage common API responses, such as authentication failures or rate limits.
This guide focuses on the initial steps to get a working DeepL API call operational. For detailed API specifications and advanced features, consult the DeepL API reference documentation.
Quick-reference setup table
| Step | What to do | Where |
|---|---|---|
| 1. Sign Up | Create a DeepL API Free or Pro account. | DeepL API Pricing page |
| 2. Get API Key | Locate your unique authentication key. | DeepL Account Dashboard |
| 3. Install SDK (Optional) | Install a DeepL client library for your preferred language (e.g., Python, Node.js). | DeepL Libraries documentation |
| 4. Make First Call | Execute a simple text translation request. | Your development environment (cURL or an SDK) |
Create an account and get keys
Access to the DeepL API requires an active DeepL API Free or Pro account. The DeepL API Free tier offers 500,000 characters per month without charge, transitioning to a pay-as-you-go model for additional usage. The Pro tier provides higher character limits and additional features for commercial use cases, as detailed on the DeepL API pricing page.
Account creation
- Navigate to the DeepL API pricing page.
- Select either the DeepL API Free or DeepL API Pro option to begin registration.
- Follow the on-screen prompts to complete the signup process, which includes providing an email address and setting a password.
- Verify your email address if prompted.
Retrieving your API key
Upon successful account creation and login, your unique authentication key will be available in your DeepL account dashboard. This key is essential for authenticating all your API requests.
- Log in to your DeepL account.
- In the account dashboard, locate the section related to API access or developer settings.
- Your API key will be displayed there. It is a long alphanumeric string.
- Security Best Practice: Treat your API key as sensitive information. Do not embed it directly in client-side code, commit it to public repositories, or share it unnecessarily. Consider using environment variables or a secrets management service for production applications. For guidance on secure credential handling, refer to resources like the Google Cloud API keys documentation.
Your first request
After obtaining your API key, you can make your first translation request. This example demonstrates translating text from English to German using both cURL and a Python SDK.
API endpoint and authentication
The base URL for the DeepL API is https://api-free.deepl.com/v2/translate for the Free tier and https://api.deepl.com/v2/translate for the Pro tier. All requests must include your API key in the Authorization header, prefixed with DeepL-Auth-Key.
cURL example (text translation)
This cURL command translates the English text "Hello, world!" to German. Replace YOUR_DEEPL_API_KEY with your actual key.
curl -X POST 'https://api-free.deepl.com/v2/translate' \
-H 'Authorization: DeepL-Auth-Key YOUR_DEEPL_API_KEY' \
-H 'Content-Type: application/json' \
-d '{"text": ["Hello, world!"], "target_lang": "DE"}'
Expected successful response (may vary slightly):
{
"translations": [
{
"detected_source_language": "EN",
"text": "Hallo, Welt!"
}
]
}
Python SDK example (text translation)
First, install the DeepL Python library:
pip install deepl
Then, use the following Python code. Replace YOUR_DEEPL_API_KEY with your key.
import deepl
# Replace with your API key
auth_key = "YOUR_DEEPL_API_KEY"
translator = deepl.Translator(auth_key)
try:
result = translator.translate_text("Hello, world!", target_lang="DE")
print(f"Detected source language: {result.detected_source_lang}")
print(f"Translated text: {result.text}")
except deepl.exceptions.DeepLException as e:
print(f"DeepL API Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Expected output:
Detected source language: EN
Translated text: Hallo, Welt!
Common next steps
After successfully performing your first translation, consider these next steps to further integrate DeepL:
- Explore Other Endpoints: Review the DeepL API reference for document translation, language detection, and usage information.
- Error Handling: Implement robust error handling for common API issues, such as rate limits (HTTP 429), authentication errors (HTTP 403), or invalid parameters (HTTP 400).
- Language Support: Familiarize yourself with the list of supported languages to ensure your application handles all desired source and target languages.
- SDK Utilization: If not already using one, integrate an official DeepL SDK for your preferred programming language (Python, Java, C#, PHP, Node.js, Go, Ruby) to simplify API interactions and manage authentication. The DeepL Libraries documentation provides installation instructions and usage examples.
- Usage Monitoring: Monitor your API usage through your DeepL account dashboard to stay within your plan limits and avoid unexpected charges.
- Document Translation: Experiment with the document translation API if your use case involves translating entire files (e.g., PDF, DOCX).
Troubleshooting the first call
If your initial API call fails, consider the following common issues:
- Incorrect API Key: Double-check that your API key is correctly copied and pasted, without extra spaces or characters. An incorrect key will typically result in an HTTP 403 Forbidden error.
- Missing Authorization Header: Ensure the
Authorizationheader is present and correctly formatted withDeepL-Auth-Key YOUR_DEEPL_API_KEY. - Incorrect Endpoint: Verify that you are using the correct API endpoint (
api-free.deepl.comfor Free tier,api.deepl.comfor Pro tier). - Invalid JSON Payload: For cURL requests, ensure your JSON body is syntactically correct and matches the expected format, particularly the
textarray andtarget_langfield. - Network Issues: Check your internet connection and any firewall settings that might be blocking outbound HTTP requests.
- Rate Limits: If you are making many requests in a short period, you might hit a rate limit, resulting in an HTTP 429 Too Many Requests error. Wait a moment and retry.
- Account Status: Confirm your DeepL account is active and in good standing.
- SDK-Specific Errors: If using an SDK, consult the specific library's documentation for common error messages and debugging tips. Ensure the SDK is properly initialized with your API key.