ForHosting KIT · Translation

Translate a JSON locale file

A locale file is a contract: the keys are the code's vocabulary and the values are what a person reads. This endpoint honors that contract — it walks the object, translates the strings, and returns a file your app can drop straight into place, same keys, same nesting, new language.

● StablePer request + per key$0.003
Use it from WebAPIEmailApp soonTelegram soon

Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.

Why locale files break so easily

A developer exports en.json, hands it to a translator, and three days later gets back a file where someone helpfully renamed a nested key or reordered an array because it read more naturally that way. The app breaks on a missing key, and nobody notices until a screen renders blank in production. translate.json avoids that entirely by treating keys as immutable identifiers and values as the only thing eligible for translation — the structure you send is the exact structure you get back.

How it decides what to translate

String values are translated. Numbers, booleans, null, and arrays of non-string values pass through unchanged, since a timeout of 3000 milliseconds means the same thing in every language. Nested objects are walked recursively, so a locale file with sections for buttons, errors, and onboarding copy gets every branch translated without flattening the structure your app relies on to look up strings.

Placeholders and interpolation stay intact

Most i18n frameworks embed variables inside strings — things like {{username}} or %s — and a translation that mangles those breaks the app at render time, not at translation time, which makes the bug much harder to trace. The endpoint recognizes common interpolation syntax and preserves it in place, moving only the surrounding language while leaving the variable markers exactly where the framework expects them.

Fitting into a release pipeline

Internationalization used to mean a spreadsheet handoff between engineering and a translation vendor, with a manual re-import step and a QA pass to catch anything that got mismatched along the way. A CI step that submits the base locale file on every merge to main and writes back each translated locale automatically closes that loop, because the response mirrors the input's key structure exactly, so a JSON schema validator can confirm nothing shifted before the file ever reaches a build. Billing per key rather than per file means a project with a lean 40-key locale file pays a fraction of what a sprawling 2,000-key admin dashboard pays, which keeps the cost proportional to the actual translation work instead of a flat per-file tax.

Mobile app localization

A mobile team submits its base en.json and receives fr.json, de.json and ja.json with identical key structures, ready to ship in the next release.

Continuous localization in CI

A web app translates its locale file automatically on every pull request that touches the base language, keeping all locales in sync without manual handoffs.

Admin dashboard strings

A B2B platform translates a large, deeply nested settings-panel locale file where key naming conventions must stay identical across every language.

Error message catalogs

A backend service translates its JSON error-message catalog so API consumers in different regions receive human-readable errors in their own language.

How do I translate a JSON locale file with the API?

POST the JSON file and target language to /translate/json, keep the returned task_id, and retrieve the translated file by webhook or a signed link valid for 24 hours.

Is the JSON translation API free?

No, there's no free tier or trial; it costs $0.003 per request plus $0.0135 per key, and a failed task is never charged.

Will my keys change or get reordered?

No, keys and their nesting stay exactly as sent; only string values are translated.

Does it handle nested objects and arrays?

Yes, it recurses through nested objects and translates string values inside arrays while leaving numbers, booleans and null untouched.

What about placeholders like {{name}} inside strings?

Common interpolation syntax is recognized and preserved in place, so variable markers stay exactly where your i18n framework expects them.

Can I translate many locale files at once?

Yes, submit one async task per locale file and collect each result independently, which suits multi-language release pipelines well.

Is this endpoint live?

Yes, /translate/json is live and accepting requests now.

Is my locale file kept after translation?

No, source and translated files are deleted after the retention window and are never used for training.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/translate/json

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.

curl -X POST https://api.kit.forhosting.com/translate/json \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":"…"}'
{
  "input": "…"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "translate.json",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.003
Per key$0.0135

Published price — no tokens, no invented credits. A failed task is never charged.

max_tokens20000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.
422task_failedThe task failed after 3 retries. You are never charged for it.

Read the full KIT documentation →