Translation API

One endpoint. JSON in, translation out.

Authenticate with a Bearer key, send a text, get a translation. Known texts are answered from memory with HTTP 200; new ones return 202 and arrive by webhook.

Your first request

Copy, paste your key, run.

HTTP 200
{
  "status": "found",
  "translation": "Add product to cart",
  "cached": true,
  "source": "global_memory",
  "match": "exact",
  "translation_id": "c6b8c562-01c4-4bd1-b78a-8b2946d2b2a2",
  "quality": { "origin": "global", "reviewed": true, "confidence": 100 },
  "livemode": true
}
curl -X POST "https://translator.coreinfra.eu/api/v1/translate" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Dodaj produkt do koszyka", "source_lang": "pl", "target_lang": "en"}'

Three answers you need to handle

200 found

Found in memory — use the translation right away.

202 pending

New text queued — show the original, wait for the webhook or poll after Retry-After.

429 RATE_LIMITED

Rate or plan limit — back off using Retry-After and X-RateLimit-Reset.

Endpoints

EndpointPurpose
POST/api/v1/translateTranslate one text
POST/api/v1/translations/batchTranslate many texts in one call
GET/api/v1/translations/{id}Status of a pending translation
GET/api/v1/memoryExport memory to a local cache (cursor)
POST/api/v1/memoryImport existing translations
GET/api/v1/languagesActive languages and project languages
GET/api/v1/usageUsage in the current period and hit rate
POST/api/v1/webhooks/testSend a test webhook

Webhooks you can trust

Results are pushed to your endpoint with an HMAC-SHA256 signature, a delivery id and automatic retries after 1, 5, 15, 60 and 360 minutes.

Headers
POST /your/webhook HTTP/1.1
Content-Type: application/json
X-TC-Event: translation.completed
X-TC-Delivery: 4812
X-TC-Signature: t=1790772003,v1=5f2b9c…e41a
<?php
$secret = getenv('TC_WEBHOOK_SECRET');
$body = file_get_contents('php://input');           // raw body, before json_decode
$header = $_SERVER['HTTP_X_TC_SIGNATURE'] ?? '';

if (!preg_match('/^t=(\d+),v1=([a-f0-9]{64})$/', $header, $m)
    || abs(time() - (int) $m[1]) > 300                // reject old deliveries (replay)
    || !hash_equals(hash_hmac('sha256', $m[1] . '.' . $body, $secret), $m[2])) {
    http_response_code(400);
    exit;
}
$event = json_decode($body, true);
// … save $event['translation'] under $event['translation_id']
http_response_code(200);

Works from any language

Plain HTTPS and JSON. Reference clients for PHP, JavaScript and Python fit in one file; WordPress has a plugin.

Open the full documentation

  • PHP 8
  • JavaScript
  • Node.js
  • Python
  • WordPress
  • cURL

Stop paying twice for the same sentence.

Create a free account, get an API key and send your first request in a few minutes.