Quickstart for the translation API

Zatiaľ nepreložené – zobrazené v angličtine.

Language API is a single HTTPS endpoint. You post an array of strings and a target language; the translated strings come back in the same order. Nothing has to be installed, and there is no job queue or callback to wire up.

What you need

  • An account with a verified e-mail address. Verification credits your team

with 100,000 characters, which is enough to work through this page and well beyond it without entering payment details.

  • One API key, created in the dashboard under API keys.
  • Any HTTP client. The examples below use curl and Node's built-in fetch.

Create an API key

Open the dashboard, choose API keys and create a key. The full key is displayed exactly once. Only a SHA-256 hash of it is stored on our side, so a lost key cannot be shown again — you revoke it and create another.

Keys have one of two prefixes:

PrefixPurpose
la_live_Production traffic
la_test_Staging and CI traffic

Both prefixes translate for real and draw from the same character budget. The prefix exists so that your usage breakdown can separate staging from production; it does not switch on a sandbox.

Make the call

The request below translates two interface strings from English into Italian. The source language is omitted, so the engine detects it.

curl https://api.langapi.xyz/v1/translate \
  -X POST \
  -H "Authorization: Bearer la_test_xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
        "text": ["Your order has been dispatched.", "Track the parcel"],
        "target_lang": "IT"
      }'

The same request from Node:

const reply = await fetch('https://api.langapi.xyz/v1/translate', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.LANGUAGE_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    text: ['Your order has been dispatched.', 'Track the parcel'],
    target_lang: 'IT',
  }),
});
const body = await reply.json();

Send Content-Type: application/json when the body is JSON. Without it, the body is parsed as a form and text is reported as missing.

Read the reply

{
  "translations": [
    { "detected_source_language": "EN", "text": "Il tuo ordine è stato spedito." },
    { "detected_source_language": "EN", "text": "Traccia il pacco" }
  ],
  "request_id": "01JAX0V3S2B8KQ9E4M7HZ6T1RD",
  "characters": 47,
  "engine": { "prompt_tokens": 63, "completion_tokens": 19, "total_tokens": 82 }
}
  • translations[n] corresponds to text[n]. The order never changes.
  • characters is the number of characters you were charged for. The response

header X-Characters-Billed carries the same value.

  • request_id identifies this call in our logs. It is also sent as the

X-Request-Id header. Keep it if you ever need to ask about a request.

  • engine reports token counts for transparency. They are not a billing unit;

see Tokens versus billed characters.

Check the remaining budget

curl https://api.langapi.xyz/v1/usage \
  -H "Authorization: Bearer la_test_xxxxxxxx"
{
  "character_count": 47,
  "character_limit": 100000,
  "billing": {
    "mode": "credit",
    "plan": "payg",
    "currency": "EUR",
    "period_end": null,
    "overage_characters": 0,
    "credit_balance": "1.499295"
  },
  "engine": { "prompt_tokens": 63, "completion_tokens": 19, "total_tokens": 82 }
}

The fields are explained on Usage and quota.

Limits that apply from the first request

RuleValue
Texts per request50
Characters per request50,000 on Pay as you go, 100,000 on Starter, 200,000 on Business
Requests per second10, 25 or 100 depending on plan
What counts as a characterEvery Unicode character in text, including whitespace and markup

Requests that fail are not charged.

Next steps

test keys and key rotation.

response fields.

ones are safe to retry.

Revidované 7. 9. 2026, 0:00