API v1

API documentation

Translation Cloud API v1: a JSON REST API that answers from Translation Memory first and uses AI only for texts it has never seen.

Base URL https://translator.coreinfra.eu/api/v1

Version v1 is stable: its behaviour does not change. New features arrive as optional parameters or as /api/v2.

Getting started

Every request is authenticated with a project API key and sends JSON. The API answers from Translation Memory whenever it can; texts it does not know yet are queued, translated by AI once and stored for good.

  1. Create a free account and a project in the panel.
  2. Generate an API key (Project → API keys). The full key is shown only once.
  3. Send POST /translate. HTTP 200 = translation ready, HTTP 202 = queued (arrives by webhook or polling).
  4. Optionally add a webhook URL to receive translation.completed events.
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"}'

One text = one request, also inside a batch. Answers from memory never consume AI characters.

Authentication

Send the key in the Authorization header as a Bearer token (recommended) or in the X-API-Key header. Keys are accepted only in headers — never in the URL or body, so they do not end up in server logs or browser history.

Headers
# Recommended
Authorization: Bearer tc_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Alternative
X-API-Key: tc_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  • tc_live_… — Live key (tc_live_…) — production traffic, counted towards your plan.
  • tc_test_… — Test key (tc_test_…) — for development: lower default rate limit (30 requests/minute), responses carry "livemode": false, memory import is not allowed.

Each key belongs to one project. You can restrict it to IP addresses, set an expiry date and a per-key rate limit, revoke or regenerate it in the panel.

Never use the API key in browser JavaScript or a mobile app. Call the API from your backend (or the WordPress plugin).

Translate

POST/api/v1/translate

Translates a single text. The response depends on whether the text is already in memory.

FieldTypeDescription
textrequiredstringText to translate (plain text or HTML fragment). Maximum length depends on your plan.
source_langoptionalstringSource language code (e.g. "pl"). Defaults to the project’s default source language.
target_langrequiredstringTarget language code (e.g. "en"). Must be active.
contextoptionalstringShort context that distinguishes identical texts, e.g. "checkout", "button". Part of the memory key; a match without context is used as a fallback.
domainoptionalstringOptional domain (e.g. "legal", "shop") — separate memory entries per domain.
typeoptionalstringHint for AI about the kind of text, e.g. "ui", "email", "product".
callback_urloptionalstring (https)HTTPS URL that receives the webhook for this particular text (in addition to project webhooks).

Statuses and HTTP codes

found · 200

HTTP 200 — translation ready. Use it right away.

pending · 202

HTTP 202 — queued. Show the original text; the translation arrives by webhook or polling.

processing · 202

HTTP 202 — the AI is translating the text right now.

failed

HTTP 200 with status "failed" — translation failed after all retries. HTTP 429 with error AI_QUOTA_EXCEEDED when the AI character quota is exhausted.

Response: found in memory (200)

JSON
{
  "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
}

Response: queued (202)

HTTP
HTTP/1.1 202 Accepted
Retry-After: 60

{
  "translation_id": "2028a8a7-df11-4325-9ccc-2af16c74b084",
  "status": "pending",
  "translation": null,
  "cached": false,
  "retry_after": 60
}

Response fields

FieldDescription
statusfound, pending, processing or failed.
translationTranslated text (null while pending).
cachedtrue when the answer comes from memory.
sourceWhere the answer came from: project_memory, global_memory, glossary or identity (same language / empty text).
matchexact, context_fallback (same text without context), numbers (same words, different numbers — the request numbers are inserted into the translation), similar (normalized match) or segments (text assembled from stored sentences).
translation_idIdentifier to use with GET /translations/{id} and in webhooks.
qualityorigin (ai, human, global, import), reviewed (bool), confidence (0–100).
retry_afterSeconds after which it makes sense to check the status (also in the Retry-After header).

Batch

POST/api/v1/translations/batch

Translates many texts in one call. Known texts return at once; the rest are queued together. The maximum number of items per call depends on your plan (BATCH_TOO_LARGE otherwise).

Send an object with "items" (each item: text, optional id, context, and per-item overrides) and shared defaults, or a bare array of strings with source_lang and target_lang in the query string.

curl -X POST "https://translator.coreinfra.eu/api/v1/translations/batch" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_lang": "pl",
    "target_lang": "en",
    "context": "checkout",
    "items": [
      {"id": "cart", "text": "Koszyk"},
      {"id": "save", "text": "Zapisz"}
    ]
  }'

# Short form: a bare array + languages in the query string
curl -X POST "https://translator.coreinfra.eu/api/v1/translations/batch?source_lang=pl&target_lang=en" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["Szukaj", "Kontakt"]'

Your "id" is echoed in the response so you can match results. Each text counts as one request.

Response

JSON
{
  "items": [
    {
      "id": "cart",
      "status": "found",
      "translation": "Cart",
      "cached": true,
      "source": "global_memory",
      "match": "exact",
      "translation_id": "8c9f22cb-3371-46fe-bcf9-b24b95b98b07",
      "quality": { "origin": "global", "reviewed": true, "confidence": 100 }
    },
    {
      "id": "new-1",
      "translation_id": "5b0e2c1a-7d44-4f7e-9f5e-0c1f3d2a9b10",
      "status": "pending",
      "translation": null,
      "cached": false,
      "retry_after": 60
    }
  ],
  "summary": { "total": 2, "found": 1, "pending": 1, "processing": 0, "failed": 0, "error": 0 },
  "livemode": true
}

Translation status

GET/api/v1/translations/{id}

Returns the current state of a translation by translation_id. Only translations of the key’s project are visible.

curl "https://translator.coreinfra.eu/api/v1/translations/2028a8a7-df11-4325-9ccc-2af16c74b084" \
  -H "Authorization: Bearer $TC_API_KEY"
JSON
{
  "translation_id": "2028a8a7-df11-4325-9ccc-2af16c74b084",
  "status": "found",
  "source_lang": "pl",
  "target_lang": "en",
  "text": "Zamów teraz za {price} zł",
  "translation": "Order now for {price} PLN",
  "created_at": "2026-09-30T12:39:57Z",
  "completed_at": "2026-09-30T12:40:03Z",
  "cached": true,
  "memory_id": "ed7c6604-4707-47a3-babf-0752d7373ebb",
  "quality": { "origin": "ai", "reviewed": false, "confidence": 78 }
}
JSON · failed
{
  "translation_id": "2028a8a7-df11-4325-9ccc-2af16c74b084",
  "status": "failed",
  "translation": null,
  "error": { "code": "TRANSLATION_FAILED", "message": "Translation failed" }
}

Poll no more often than Retry-After says — or better, use webhooks.

Translation Memory

Translation Memory is the heart of the service. Every translation is stored with its version history, origin and quality score.

How a text is matched

  1. Normalization: Unicode form (NFC), whitespace including non-breaking spaces, line endings and HTML tag case are unified, so trivial differences do not create new entries. Similar match additionally ignores letter case and trailing punctuation.
  2. Placeholders ({name}, {{count}}, %s, :price, HTML tags and entities) are replaced with locked tokens before AI and must be present in the result.
  3. Lookup order: Project Memory (exact, then without context) → Global Memory → similar match → AI queue.
  4. Entries reviewed by a human are never overwritten by AI.

Export: GET /memory

GET/api/v1/memory?source_lang&target_lang&updated_since&cursor&limit

Download project memory in pages (limit up to 1000, next_cursor) to keep a local cache — a page that is already translated then needs no API call at all. Filter with source_lang, target_lang and updated_since for incremental syncs.

# First page
curl "https://translator.coreinfra.eu/api/v1/memory?source_lang=pl&target_lang=en&limit=500" \
  -H "Authorization: Bearer $TC_API_KEY"

# Next page: pass next_cursor; incremental sync: updated_since
curl "https://translator.coreinfra.eu/api/v1/memory?cursor=136&updated_since=2026-09-01T00:00:00Z" \
  -H "Authorization: Bearer $TC_API_KEY"
JSON
{
  "items": [
    {
      "id": "ef602640-61d9-47f7-a7f5-9e66562e10f2",
      "source_lang": "pl",
      "target_lang": "en",
      "context": "",
      "text": "Witaj {{name}}, masz {{count}} produktów w koszyku.",
      "translation": "Hello {{name}}, you have {{count}} products in your cart.",
      "origin": "ai",
      "reviewed": false,
      "updated_at": "2026-09-30T12:27:34Z"
    }
  ],
  "next_cursor": 136
}

Import: POST /memory

POST/api/v1/memory

Load existing translations (e.g. from .po or JSON files) — up to 500 items per request, live key only. Imported entries are served from memory immediately.

cURL
curl -X POST "https://translator.coreinfra.eu/api/v1/memory" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_lang": "pl",
    "target_lang": "en",
    "items": [
      {"text": "Moje zamówienia", "translation": "My orders"},
      {"text": "Zamów", "translation": "Place order", "context": "checkout"}
    ]
  }'

# HTTP 201
{ "result": { "created": 2, "updated": 0, "skipped": 0, "invalid": 0 } }

Usage

GET/api/v1/usage

Returns usage in the current billing period for the account and the key’s project, including the cache hit rate.

cURL · JSON
curl "https://translator.coreinfra.eu/api/v1/usage" -H "Authorization: Bearer $TC_API_KEY"

{
  "period": { "start": "2026-09-30T12:20:45Z", "end": "2026-10-14T12:20:45Z" },
  "plan": { "name": "Business", "slug": "business", "overage_enabled": false },
  "account": {
    "requests": { "used": 15, "limit": 50000 },
    "ai_characters": { "used": 118, "limit": 100000 }
  },
  "project": {
    "requests": 15,
    "batch_requests": 3,
    "cache_hits": 10,
    "cache_misses": 4,
    "cache_hit_rate": 66.67
  }
}

Languages

GET/api/v1/languages

Returns active languages and the languages configured for the key’s project. Use it instead of hard-coding codes: new languages are switched on without changes to the API.

cURL · JSON
curl "https://translator.coreinfra.eu/api/v1/languages" -H "Authorization: Bearer $TC_API_KEY"

{
  "languages": [
    { "code": "en", "name": "English", "native_name": "English", "direction": "ltr" },
    { "code": "pl", "name": "Polish", "native_name": "Polski", "direction": "ltr" }
  ],
  "project": {
    "default_source_lang": "pl",
    "languages": [
      { "code": "en", "source": false, "target": true },
      { "code": "pl", "source": true, "target": false }
    ]
  }
}

Webhooks

Webhooks push results to your server so you never have to poll. Configure URLs per project in the panel or pass callback_url with a request.

Events

translation.completedA queued translation is ready (also when it was completed from memory in the meantime).
translation.failedA translation failed after all retries.
webhook.testTest delivery sent from the panel or POST /webhooks/test.

Headers

X-TC-EventEvent name.
X-TC-DeliveryUnique delivery id — use it to ignore duplicates.
X-TC-Signaturet=<unix time>,v1=<hex(HMAC-SHA256(secret, t + "." + body))>
HTTP
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

Payload: translation.completed

JSON
{
  "event": "translation.completed",
  "translation_id": "2028a8a7-df11-4325-9ccc-2af16c74b084",
  "memory_id": "ed7c6604-4707-47a3-babf-0752d7373ebb",
  "project_id": "0b6f3f9e-5a0c-4c1b-8a57-3c2d1e9f7a21",
  "source_lang": "pl",
  "target_lang": "en",
  "text": "Zamów teraz za {price} zł",
  "translation": "Order now for {price} PLN",
  "context": "checkout",
  "created_at": "2026-09-30T12:40:03Z"
}

Payload: translation.failed

JSON
{
  "event": "translation.failed",
  "translation_id": "2028a8a7-df11-4325-9ccc-2af16c74b084",
  "source_lang": "pl",
  "target_lang": "en",
  "error": { "code": "TRANSLATION_FAILED", "message": "Translation failed" },
  "created_at": "2026-09-30T13:02:11Z"
}

Verifying the signature

Compute the HMAC over the raw request body with your project’s webhook secret (panel → Webhooks), compare in constant time and reject deliveries older than 5 minutes.

<?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);

Retries

Respond with any 2xx status within a few seconds. Otherwise the delivery is retried after 1, 5, 15, 60 and 360 minutes; the log of every attempt is visible in the panel.

Test: POST /webhooks/test

Sends a webhook.test event to the project’s active webhooks, or to the https URL given in the body.

cURL
curl -X POST "https://translator.coreinfra.eu/api/v1/webhooks/test" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/webhooks/tc"}'

SDKs & plugins

The API is plain HTTPS + JSON, so any HTTP client works. Below are reference clients in one file each — copy them into your project.

PHP

PHP 8.1+, ext-curl, no Composer dependencies.

JavaScript / Node.js

Node.js 18+ (built-in fetch). Server-side only.

Python

Python 3.8+ with requests.

WordPress plugin

Available in the panel for the Start plan and above. It translates theme and plugin strings through the API and keeps a local cache synced with GET /memory.

<?php
final class TranslationCloud
{
    public function __construct(private string $key, private string $base = 'https://translator.coreinfra.eu/api/v1') {}

    public function translate(string $text, string $to, string $from = 'pl', array $opt = []): array
    {
        return $this->call('POST', '/translate', ['text' => $text, 'source_lang' => $from, 'target_lang' => $to] + $opt);
    }

    public function batch(array $items, string $to, string $from = 'pl'): array
    {
        return $this->call('POST', '/translations/batch', ['items' => $items, 'source_lang' => $from, 'target_lang' => $to]);
    }

    public function status(string $id): array
    {
        return $this->call('GET', '/translations/' . rawurlencode($id));
    }

    private function call(string $method, string $path, ?array $body = null): array
    {
        $ch = curl_init($this->base . $path);
        curl_setopt_array($ch, [
            CURLOPT_CUSTOMREQUEST => $method,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_TIMEOUT => 15,
            CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $this->key, 'Content-Type: application/json'],
            CURLOPT_POSTFIELDS => $body !== null ? json_encode($body) : null,
        ]);
        $json = json_decode((string) curl_exec($ch), true) ?? [];
        return ['http' => curl_getinfo($ch, CURLINFO_HTTP_CODE)] + $json;
    }
}

$tc = new TranslationCloud(getenv('TC_API_KEY'));
echo $tc->translate('Koszyk', 'en')['translation']; // "Cart"

Examples

Complete examples of the most common task: translate a text and handle both answers. Switch the language tab — your choice is remembered on all code blocks.

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"}'

Batch

curl -X POST "https://translator.coreinfra.eu/api/v1/translations/batch" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "source_lang": "pl",
    "target_lang": "en",
    "context": "checkout",
    "items": [
      {"id": "cart", "text": "Koszyk"},
      {"id": "save", "text": "Zapisz"}
    ]
  }'

# Short form: a bare array + languages in the query string
curl -X POST "https://translator.coreinfra.eu/api/v1/translations/batch?source_lang=pl&target_lang=en" \
  -H "Authorization: Bearer $TC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '["Szukaj", "Kontakt"]'

Polling a pending translation

curl "https://translator.coreinfra.eu/api/v1/translations/2028a8a7-df11-4325-9ccc-2af16c74b084" \
  -H "Authorization: Bearer $TC_API_KEY"

Syncing memory to a local cache

# First page
curl "https://translator.coreinfra.eu/api/v1/memory?source_lang=pl&target_lang=en&limit=500" \
  -H "Authorization: Bearer $TC_API_KEY"

# Next page: pass next_cursor; incremental sync: updated_since
curl "https://translator.coreinfra.eu/api/v1/memory?cursor=136&updated_since=2026-09-01T00:00:00Z" \
  -H "Authorization: Bearer $TC_API_KEY"

Errors

Errors always use the same JSON shape and an appropriate HTTP status. Branch on error.code — messages may change.

HTTP
HTTP/1.1 422 Unprocessable Entity

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Validation failed",
    "details": { "fields": { "text": "The \"text\" field is required and must be a string" } }
  }
}
CodeHTTPMeaning
INVALID_JSON400The request body is not valid JSON.
UNAUTHORIZED401No API key in the request.
INVALID_API_KEY401The key does not exist.
API_KEY_REVOKED401The key has been revoked.
API_KEY_EXPIRED401The key has expired.
ACCOUNT_SUSPENDED403The account is suspended (e.g. unpaid invoice).
PROJECT_INACTIVE403The project is paused or deleted.
IP_NOT_ALLOWED403The request comes from an IP outside the key’s allowlist.
TEST_KEY_FORBIDDEN403The operation requires a live key.
NOT_FOUND404The resource does not exist (or belongs to another project).
PAYLOAD_TOO_LARGE413The request body is too large.
VALIDATION_ERROR422Invalid or missing fields — see details.fields.
BATCH_TOO_LARGE422More items than your plan allows — see details.max_batch_size.
TEXT_TOO_LONG422The text exceeds the per-text character limit of your plan.
UNSUPPORTED_LANGUAGE422The language code is unknown or inactive.
INVALID_CALLBACK_URL422callback_url must be a valid https:// URL.
RATE_LIMITED429Too many requests per minute — wait Retry-After seconds.
PLAN_LIMIT_REACHED429Monthly request limit reached — upgrade or enable additional usage.
AI_QUOTA_EXCEEDED429AI character quota exhausted; texts from memory still work.
INTERNAL_ERROR500Unexpected server error — it has been logged. Retry later.
SERVICE_UNAVAILABLE503Temporary unavailability (e.g. database). Retry with backoff.

In a batch, per-item problems (e.g. TEXT_TOO_LONG, UNSUPPORTED_LANGUAGE) are returned inside that item with status "error"; the rest of the batch is processed normally.

Rate limits

Limits apply per API key, per project and per account (plan). Every response carries the headers below; when a limit is exceeded you receive HTTP 429 RATE_LIMITED.

HeaderDescription
X-RateLimit-LimitRequests allowed in the current one-minute window.
X-RateLimit-RemainingRequests left in the window.
X-RateLimit-ResetUnix time when the window resets.
Retry-AfterSeconds to wait (on 429 and 202 responses).
HTTP
HTTP/1.1 429 Too Many Requests
X-RateLimit-Limit: 1200
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1790772060
Retry-After: 42

{
  "error": {
    "code": "RATE_LIMITED",
    "message": "Too many requests. Slow down and retry after the reset time.",
    "details": { "limit": 1200, "scope": "c" }
  }
}

Back off using Retry-After, add jitter, and prefer batch requests for bulk work. The monthly plan limit (PLAN_LIMIT_REACHED) is separate from the per-minute rate limit.