Uxwebhu lwe-API

Yongeza uguqulelo olunamandla kwiinkqubo zakho nge-REST API yethu elula.

Ukuqala

I-TranslateAPI ibonelela ngonxibelelwano olulula lwe-REST lokuguqulela umbhalo phakathi kweelwimi ezingaphezu kwe-180. Zonke iziphelo ze-API zibuyisela iimpendulo ze-JSON.

1. Get Your API Key

Create a free account and generate your API key from the dashboard:

  1. Sign up at translateapi.ai/signup
  2. Go to I-Dashboard → Iqhosha le-API
  3. Click "Create API Key" and copy your key

API keys start with ta_ followed by 56 hex characters.

Isiseko se URL: https://api.translateapi.ai/api/v1/
2. Make Your First Request

Replace YOUR_API_KEY with the key from your dashboard:

curl -X POST https://api.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(
    "https://api.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("https://api.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!"
$ch = curl_init("https://api.translateapi.ai/api/v1/translate/");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer YOUR_API_KEY",
        "Content-Type: application/json"
    ],
    CURLOPT_POSTFIELDS => json_encode([
        "text" => "Hello, world!",
        "target_language" => "es"
    ])
]);

$result = json_decode(curl_exec($ch), true);
echo $result["translated_text"];  // "Hola, mundo!"
payload := strings.NewReader(`{
    "text": "Hello, world!",
    "target_language": "es"
}`)

req, _ := http.NewRequest("POST", "https://api.translateapi.ai/api/v1/translate/", payload)
req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")

resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()

var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
fmt.Println(result["translated_text"])  // "Hola, mundo!"
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_KEY");

var content = new StringContent(
    JsonSerializer.Serialize(new {
        text = "Hello, world!",
        target_language = "es"
    }),
    Encoding.UTF8,
    "application/json"
);

var response = await client.PostAsync("https://api.translateapi.ai/api/v1/translate/", content);
var result = JsonSerializer.Deserialize<JsonElement>(
    await response.Content.ReadAsStringAsync()
);
Console.WriteLine(result.GetProperty("translated_text"));  // "Hola, mundo!"
Impendulo
{
    "translated_text": "Hola, mundo!",
    "source_language": "en",
    "target_language": "es",
    "translations": {
        "es": "Hola, mundo!"
    },
    "character_count": 13,
    "translation_time": 0.45
}

Uqinisekiso

Qinisekisa izicelo zakho usebenzisa iqhosha le-API. Ungenza amaqhosha e-API ukusuka kwi- ibhodi eqhotyoshwayo.

Ububhali Bokubhaliweyo okuphezulu kwephepha (Kucetyiswa)
Authorization: Bearer ta_your_api_key_here
ApiKey Header
Authorization: ApiKey ta_your_api_key_here
Iparamitha Yombuzo
https://api.translateapi.ai/api/v1/translate/?api_key=ta_your_api_key_here
Gcina izitshixo zakho ze-API zikhuselekile! Musa ukuzibonisa kwikhowudi yecala lomxhasi okanye kwiindawo zokugcina zabucala.

Guqulela Okubhaliweyo

Uguqulelo lomsebenzi kolunye ulwimi

POST https://api.translateapi.ai/api/v1/translate/
Isiqu Sesicelo
Parameters Udidi Ifunekayo Inkcazelo
text string Hayi Umbhalo oza kuguqulelwa (max 50, 000 characters)
target_language string Ewe* Target language code (e.g., "es", "fr", "de")
source_language string Akukho nanye Source language code. Default: "auto" (auto-detect)
engine string Akukho nanye Translation engine: "auto" (default), "huggingface", or "madlad". See Translation Models. Iimodeli zoguqulelo.

* Sebenzisa target_language (uluhlu lwamagama) ulwimi olunye okanye target_languages (i-array) ye-multiple. Bona Uguqulelo lwe-Multi-Target.

Impendulo
{
    "translated_text": "Hola, mundo!",
    "source_language": "en",
    "target_language": "es",
    "translations": {
        "es": "Hola, mundo!"
    },
    "character_count": 13,
    "translation_time": 0.45
}
Auto-Detection: Omit source_language or set it to "auto" to automatically detect the source language. The detected language is returned in the source_language response field.

Uguqulelo lwe-Multi-Target

Guqulela umbhalo kwiilwimi ezininzi kwisicelo esisodwa. Isebenzisa incopho yesiphelo esifanayo njengoguqulelo olulodwa.

POST https://api.translateapi.ai/api/v1/translate/
Isiqu Sesicelo
{
    "text": "Hello, world!",
    "target_languages": ["es", "fr", "de", "ja"],
    "source_language": "en"
}

Sebenzisa target_languages (umqolo) endaweni ye target_language (umtya) kwiinjongo ezininzi.

Impendulo
{
    "source_language": "en",
    "translations": {
        "es": "Hola, mundo!",
        "fr": "Bonjour, monde!",
        "de": "Hallo, Welt!",
        "ja": "こんにちは、世界!"
    },
    "character_count": 52,
    "translation_time": 2.31
}
Udidi: Ungaguqulela ukuya kuthi ga kwiilwimi ezili-50 kwisicelo esisodwa.

Uguqulelo lwe batch

Uguqulelo lomsebenzi kolunye ulwimi:

Limits: Max 100 texts per batch, max 300 total items (texts × target languages). Jobs time out 45 minutes after processing starts.
Speed: Common languages (ES, FR, DE) use fast models (~0.1s/text). Less common languages use our multilingual model (~1-3s/text).
POST https://api.translateapi.ai/api/v1/translate/batch/
Inyathelo 1: Thumela Iqela
curl -X POST https://api.translateapi.ai/api/v1/translate/batch/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "texts": ["Hello", "Goodbye", "Thank you"],
    "target_language": "es",
    "source_language": "en"
}'
Impendulo (HTTP 202 Yamkelwe)
{
    "job_id": "67535b2b-c9e3-4f82-9499-e237edbc1dd8",
    "status": "pending",
    "total_texts": 3,
    "queue_position": 1,
    "source_language": "en",
    "target_languages": ["es"],
    "character_count": 22,
    "credits_remaining": -1,
    "poll_url": "https://api.translateapi.ai/api/v1/jobs/67535b2b-c9e3-4f82-9499-e237edbc1dd8/"
}
Inyathelo lesi-2: Ukhetho lweeNkqubo
GET https://api.translateapi.ai/api/v1/jobs/{job_id}/
Umzekelo wePolling (Python)
import time, requests

job_id = response.json()["job_id"]
total = response.json()["total_texts"]
headers = {"Authorization": "Bearer YOUR_API_KEY"}

print(f"Batch submitted: {total} texts (job {job_id})")

while True:
    result = requests.get(f"https://api.translateapi.ai/api/v1/jobs/{job_id}/", headers=headers).json()
    status = result["status"]
    processed = result.get("processed_texts", 0)
    progress = result.get("progress_percentage", 0)

    if status == "completed":
        print(f"Done: {processed}/{total} in {result.get('processing_time', 0):.1f}s")
        translations = result["result_data"]["translations"]
        break
    elif status == "failed":
        raise Exception(result.get("error_message", "Translation failed"))
    elif status == "pending":
        print(f"Queued (position {result.get('queue_position', '?')})")
    else:
        print(f"[{status}] {processed}/{total} ({progress:.0f}%)")

    time.sleep(3)
Impendulo (igqityiwe)
{
    "job_id": "67535b2b-...",
    "status": "completed",
    "processed_texts": 3,
    "total_texts": 3,
    "progress_percentage": 100.0,
    "processing_time": 10.65,
    "result_data": {
        "translations": ["Hola", "Adiós", "Gracias"],
        "source_language": "en",
        "target_language": "es",
        "character_count": 22,
        "processing_time": 10.65
    }
}
Real-Time Progress Tracking
Field Inkcazelo
status pending (queued, waiting for a GPU worker), processing (actively translating), completed, failed
processed_texts Number of individual translations completed so far. Updates in real time as each text is translated.
progress_percentage Completion percentage (0-100). Calculated from processed_texts / total_texts.
queue_position Your position in the queue when status is "pending" (1 = next up). Null when processing or completed. Use this to estimate wait time and show queue status to your users.
processing_time Total processing time in seconds (available when completed).
Ulwimi oluninzi

Uguqulelo lomsebenzi kolunye ulwimi:

{
    "texts": ["Hello", "Goodbye"],
    "target_languages": ["es", "fr"],
    "source_language": "en"
}
I-_data yeziphumo ezigqityiweyo
{
    "translations": [
        {"es": "Hola", "fr": "Bonjour"},
        {"es": "Adiós", "fr": "Au revoir"}
    ],
    "source_language": "en",
    "target_languages": ["es", "fr"],
    "character_count": 24,
    "processing_time": 2.45
}
Iparameters Zesicelo
Parameters Udidi Ifunekayo Inkcazelo
texts array Hayi Uluhlu lwamagama okuguqulela
target_language string Ewe* Ikhowudi yoLwimi oluSebenzayo loLwimi olulodwa
target_languages array Ewe* Udweliso lweekhowudi zolwimi lwesiphelo lweelwimi ezininzi
source_language string Akukho nanye Source language code. Default: "auto"

* Sebenzisa target_language okanye target_languages, hayi zombini.

Best Practices for Large Workloads
  • Send 1 target language per batch request. This keeps each batch fast and makes progress easy to track.
  • Keep batches at 50-100 texts. Smaller batches complete faster and give you more frequent progress updates.
  • Submit as many batch jobs as you need — our GPU cluster auto-scales to handle demand. Jobs are processed in parallel across multiple instances.
  • On timeout, re-poll the same job_id instead of submitting a new batch. The original job may still be processing on the GPU.
  • Poll every 3-5 seconds. More frequent polling does not speed up processing.

Uguqulelo loxwebhu

Iguqulela uxwebhu lonke ngelixa igcina ufomati. Ixhasa iifomati ezininzi zefayile.

POST https://api.translateapi.ai/api/v1/translate/document/
Isicelo (inxalenye eninzi/ifomu-data)
Parameters Udidi Ifunekayo Inkcazelo
file file Hayi Uxwebhu lokuguqulela (max 10MB)
target_language string Hayi Target language code (e.g., "es", "fr", "de")
source_language string Akukho nanye Source language code. Default: "auto" (auto-detect)
Udidi lwefayile oluxhaswayo
Documents
  • .txt - Iifayili zombhalo oqhelekileyo
  • .docx - Uxwebhu lwe-Word
  • .pdf - Amaxwebhu e-PDF (kuquka ashicilelwe phantsi)
Data & Localization
  • .json - Iifayili ze-JSON (ziguqula amaxabiso omtya)
  • .xml - Iifayile ze XML
  • .srt - Iifayili zesicatshulwa esezantsi
  • .po / .pot - Uguqulelo lomsebenzi kolunye ulwimi
Images (OCR)
  • .jpg / .jpeg - Imifanekiso ye JPEG (OCR)
  • .png - Imifanekiso ye PNG (OCR)
  • .tiff / .tif - Imifanekiso ye-TIFF (OCR)
  • .bmp - Imifanekiso ye-BMP (OCR)
  • .webp - Imifanekiso ye-WebP (OCR)
Umzekelo (cURL)
# Translate a Word document
curl -X POST https://api.translateapi.ai/api/v1/translate/document/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@document.docx" \
  -F "target_language=es" \
  -F "source_language=en"

# Translate text from an image (OCR)
curl -X POST https://api.translateapi.ai/api/v1/translate/document/ \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@scanned_page.jpg" \
  -F "target_language=es" \
  -F "source_language=en"
Impendulo
{
    "id": 123,
    "original_filename": "document.docx",
    "file_type": "docx",
    "source_language": "en",
    "target_language": "es",
    "status": "completed",
    "character_count": 5420,
    "translated_file_url": "/media/translated/document_es.docx",
    "created_at": "2024-01-15T10:30:00Z",
    "completed_at": "2024-01-15T10:30:05Z"
}
OCR Inkxaso: Iifayili zomfanekiso kunye nee-PDF ezixhonywe ziqhutywa ngokwaziwa kophawu olubonakalayo (OCR) ukutsala umbhalo phambi kokuguqulela. Ukufumana iziphumo ezilungileyo, sebenzisa imifanekiso ecacileyo, enesigqibo esiphezulu.
GET https://api.translateapi.ai/api/v1/translate/document/{id}/

Khangela ubume boguqulelo loxwebhu okanye ubuyisele ulwaleko lwe URL.

Amaxabiso emeko
pending Ifayile ilayishelwe phezulu, ilinde ukuqhubekekiswa
processing Uguqulelo luyaqhubeka
completed Uguqulelo lugqityiwe, ulayisho ezantsi lufumanekayo
failed Uguqulelo aluphumelelanga (khangela umyalezo we-error)

Iilwimi ezixhaswayo

Fumana uluhlu lwazo zonke iilwimi ezixhaswayo.

GET https://api.translateapi.ai/api/v1/translate/languages/
Impendulo
{
    "count": 186,
    "results": [
        {"iso": "en", "name": "English", "en_label": "English"},
        {"iso": "es", "name": "Español", "en_label": "Spanish"},
        {"iso": "fr", "name": "Français", "en_label": "French"},
        ...
    ]
}

View All 186 Languages

Submit Corrections

Suggest a better translation for a given source text. Corrections enter a moderation queue; once approved by our team they surface as "Community Verified" translations for that text.

Note: this endpoint is served from the main domain https://translateapi.ai/api/v1/ (not the api. translation host), and requires an API key.
POST https://translateapi.ai/api/v1/suggestions/
Isiqu Sesicelo
Parameter Udidi Inkcazelo
source_text string The original text that was translated.
source_language string Source language code (e.g. "en").
target_language string Target language code (e.g. "es").
machine_translation string The machine translation you are correcting.
suggested_translation string Your improved translation (must differ from machine_translation).
Example Request
curl -X POST https://translateapi.ai/api/v1/suggestions/ \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
    "source_text": "Hello, world!",
    "source_language": "en",
    "target_language": "es",
    "machine_translation": "Hola, mundo!",
    "suggested_translation": "¡Hola, mundo!"
}'
Impendulo
{
    "id": 4213,
    "status": "pending",
    "created": true,
    "message": "Correction submitted for review."
}

Re-submitting the same source/language pair updates your existing suggestion instead of creating a duplicate (returns 200 with "created": false).

Iimodeli zoguqulelo

Sisebenzisa imodeli yoguqulelo oluvulekileyo lwe-state-of-the-art oluqhuba kwinkqubo yethu ye-GPU. Zonke iimodeli zinikezelwa ngelayisensi yorhwebo (i-Apache 2.0).

Imodeli Iilwimi Elungileyo Ku
Helsinki-NLP/opus-mt 50+ Iiperi zoLwimi Iilwimi eziqhelekileyo (EN, ES, FR, DE, IT, PT, RU, ZH, JA, njl.)
Google MADLAD-400 400+ Iilwimi Iilwimi ezingaqhelekanga, ukugubungela okupheleleyo

I-API ikhetha ngokuzenzekelayo imodeli elungileyo yesibini sakho se-language. Ungakhankanya ngokuzenzekelayo imodeli ye- engine iparamitha:

Injini Inkcazelo
"auto" Okumiselweyo. Izama i-HuggingFace kuqala, ibuyela umva kwi-MADLAD-400
"huggingface" Force HuggingFace/MarianMT (ekhawulezayo, 50+ ulwimi)
"madlad" Force MADLAD-400 (400+ ulwimi)

Uphatho Lwemposiso

I-API isebenzisa ikhowudi yesimo se-HTTP esiqhelekileyo sokubonisa ukuba uphumelele okanye awuphumelelanga.

Ikhowudi Inkcazelo
200 Impumelelo
202 Accepted — Batch job queued successfully
400 Bad Request — Invalid parameters (missing text, unsupported language, etc.)
401 Ayigunyaziswanga - Isitshixo se-API esingasebenziyo okanye esilahlekileyo
402 Payment Required — Character credits exhausted. Upgrade your plan or purchase a top-up.
403 Forbidden — API key lacks required scope or IP not in whitelist
503 Inkonzo Ayifumaneki - Injini Yokuguqula kolunye ulwimi iyasezantsi
Ifomati Yempendulo Yemposiso
{
    "error": "insufficient_credits",
    "credits_remaining": 0
}

Usage Limits

TranslateAPI has no request rate limits. All requests are queued and processed by our auto-scaling GPU cluster. Your plan determines your monthly character allowance:

I-Plan Iimpawu/Inyanga Batch API Documents Ixabiso
Ekhululekileyo 250,000 $0 Ubhaliso simahla
Isiqalisi 2,500,000 $9/inyanga( ii) Buyisela okubhaliweyo
I-Pro 10,000,000 $29/inyanga( ii) Buyisela okubhaliweyo
Ishishini 40,000,000 $79/inyanga( ii) Buyisela okubhaliweyo
Umlinganiselo 125,000,000 $199/inyanga( ii) Buyisela okubhaliweyo
Enterprise Unlimited $499/inyanga( ii) Contact Sales

xa udlula umda wakho, uya kufumana 402 Payment Required unyaka olandelayo okanye uphucule.

Auto-Scaling Cloud Infrastructure

TranslateAPI runs on dedicated NVIDIA A100 GPU instances with automatic horizontal scaling. When demand increases, additional GPU instances are launched within minutes to maintain fast response times. All requests are queued and processed — send hundreds of concurrent requests and they'll all be handled. Real-time translations get priority, batch jobs process in the background.

Need More Credits?

Run out of characters mid-month? Purchase a one-time credit top-up without changing your plan. View top-up packs

Linganisa eli phepha
Enkosi ngexabiso lakho!
/5 1999/2000 ii-ratings