API Documentation

Integrate powerful translation into your applications with our simple REST API.

Getting Started

The TranslateAPI provides a simple REST interface for translating text between 200+ languages. All API endpoints return JSON responses.

Base URL: http://www.translateapi.ai/api/v1/
Quick Start

Make your first translation request:

curl -X POST http://www.translateapi.ai/api/v1/translate/ \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "text": "Hello, world!",
    "target_language": "es"
  }'
import requests

response = requests.post(
    "http://www.translateapi.ai/api/v1/translate/",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    json={
        "text": "Hello, world!",
        "target_language": "es"
    }
)

result = response.json()
print(result["translated_text"])  # "Hola, mundo!"
const response = await fetch("http://www.translateapi.ai/api/v1/translate/", {
    method: "POST",
    headers: {
        "Authorization": "Bearer YOUR_API_KEY",
        "Content-Type": "application/json"
    },
    body: JSON.stringify({
        text: "Hello, world!",
        target_language: "es"
    })
});

const result = await response.json();
console.log(result.translated_text);  // "Hola, mundo!"

Authentication

Authenticate your requests using an API key. You can create API keys from your dashboard.

Header Authentication (Recommended)
Authorization: Bearer ta_your_api_key_here
Query Parameter
http://www.translateapi.ai/api/v1/translate/?api_key=ta_your_api_key_here
Keep your API keys secure! Do not expose them in client-side code or public repositories.

Translate Text

Translate text to a single target language.

POST /api/v1/translate/
Request Body
Parameter Type Required Description
text string Yes Text to translate (max 50,000 characters)
target_language string Yes Target language code (e.g., "es", "fr", "de")
source_language string No Source language code. Default: "auto" (auto-detect)
Response
{
    "translated_text": "Hola, mundo!",
    "source_language": "en",
    "target_language": "es",
    "character_count": 13
}

Multi-Target Translation

Translate text to multiple languages in a single request.

POST /api/v1/translate/multi/
Request Body
{
    "text": "Hello, world!",
    "target_languages": ["es", "fr", "de", "ja"],
    "source_language": "en"
}
Response
{
    "translations": {
        "es": "Hola, mundo!",
        "fr": "Bonjour, monde!",
        "de": "Hallo, Welt!",
        "ja": "こんにちは、世界!"
    },
    "source_language": "en",
    "character_count": 13
}

Batch Translation

Translate multiple texts to a single language in one request.

POST /api/v1/translate/batch/
Request Body
{
    "texts": ["Hello", "Goodbye", "Thank you"],
    "target_language": "es",
    "source_language": "en"
}
Response
{
    "translations": ["Hola", "Adios", "Gracias"],
    "source_language": "en",
    "target_language": "es",
    "character_count": 22
}

Language Detection

Detect the language of a text.

POST /api/v1/translate/detect/
Request Body
{
    "text": "Bonjour, comment allez-vous?"
}
Response
{
    "language": "fr",
    "confidence": 0.98
}

Supported Languages

Get the list of all supported languages.

GET /api/v1/languages/
Response
{
    "languages": [
        {"code": "en", "name": "English", "native_name": "English"},
        {"code": "es", "name": "Spanish", "native_name": "Espanol"},
        {"code": "fr", "name": "French", "native_name": "Francais"},
        ...
    ],
    "count": 200
}

Error Handling

The API uses standard HTTP status codes to indicate success or failure.

Code Description
200 Success
400 Bad Request - Invalid parameters
401 Unauthorized - Invalid or missing API key
429 Too Many Requests - Rate limit exceeded
503 Service Unavailable - Translation service temporarily down
Error Response Format
{
    "error": "Description of the error"
}

Rate Limits

Rate limits vary by plan:

Plan Requests/Hour Characters/Day
Free 50 5,000
Starter ($9.99/mo) 500 100,000
Professional ($29.99/mo) 2,000 500,000
Enterprise ($99.99/mo) Unlimited Unlimited

When you exceed your rate limit, you'll receive a 429 Too Many Requests response.