Quick Start
Get up and running with TranslatePlus API in just a few minutes. This guide will walk you through making your first translation request and show you common use cases.
Prerequisites
- A TranslatePlus account (Sign up if you don't have one)
- An API key from your dashboard
- Basic knowledge of HTTP requests
Step 1: Get Your API Key
- Sign up for a TranslatePlus account (or log in if you already have one)
- Navigate to the API Keys section in your dashboard
- Generate a new API key or copy your existing one
- Keep your API key secure - you'll need it for all API requests
Tip: Store your API key in an environment variable for security. Never commit it to version control.
Step 2: Make Your First Translation Request
Let's translate "Hello, world!" from English to French. Choose your preferred language:
curl https://api.translateplus.io/v2/translate \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello, world!",
"source": "en",
"target": "fr"
}'Step 3: Understanding the Response
A successful response looks like this:
{
"translations": {
"text": "Hello, world!",
"translation": "Bonjour le monde!",
"source": "en",
"target": "fr"
},
"details": {}
}Response Fields:
translations.text- The original text you senttranslations.translation- The translated texttranslations.source- Detected or specified source languagetranslations.target- Target languagedetails- Additional metadata (empty for basic requests)
Step 4: Common Use Cases
Auto-Detect Source Language
You can let the API detect the source language automatically:
curl https://api.translateplus.io/v2/translate \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Hola, mundo!",
"source": "auto",
"target": "en"
}'Batch Translation
Translate multiple texts in a single request:
curl https://api.translateplus.io/v2/translate/batch \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"texts": [
"Hello, world!",
"How are you?",
"Thank you very much"
],
"source": "en",
"target": "fr"
}'Detect Language
Detect the language of a text:
curl https://api.translateplus.io/v2/detect_language \
-H "X-API-KEY: your_api_key" \
-H "Content-Type: application/json" \
-d '{
"text": "Bonjour le monde!"
}'Step 5: Error Handling
Always handle errors in your code. Common error responses:
401 Unauthorized - Invalid API key:
{
"detail": "API key is required. Please provide X-API-KEY header."
}400 Bad Request - Invalid parameters:
{
"detail": "Invalid source language code: 'invalid'"
}402 Payment Required - Insufficient credits:
{
"detail": "Insufficient credits. You have 0 credit(s) remaining."
}429 Too Many Requests - Rate limit exceeded:
{
"detail": "Rate limit exceeded. Please try again later."
}import requests
try:
response = requests.post(
"https://api.translateplus.io/v2/translate",
headers={"X-API-KEY": "your_api_key", "Content-Type": "application/json"},
json={"text": "Hello", "source": "en", "target": "fr"}
)
response.raise_for_status() # Raises exception for 4xx/5xx
result = response.json()
print(f"Translation: {result['translations']['translation']}")
except requests.exceptions.HTTPError as e:
error_data = e.response.json() if e.response else {}
print(f"Error {e.response.status_code}: {error_data.get('detail', 'Unknown error')}")
except Exception as e:
print(f"Error: {e}")Next Steps
Now that you've made your first request, explore more:
- Authentication Guide - Learn about API keys, security, and best practices
- API Reference - Complete endpoint documentation
- Code Examples - More examples in different languages
- Error Handling - Comprehensive error handling guide
- Supported Languages - List of all supported languages
- Rate Limits - Understand API rate limits and quotas