API Reference
Localify exposes a simple REST API for translating JSON locale files programmatically. Perfect for CI/CD pipelines, GitHub Actions, and build scripts.
Overview
Base URL: https://localify.eeiae.com/api/v1
All requests use Content-Type: application/json and authenticate with a Bearer token.
Usage is counted against your monthly plan quota. The response always includes a meta object showing current usage.
Authentication
All API requests require an Authorization header with your API key. Keys are available from Settings → API key.
Authorization: Bearer lfy_your_api_key_here
POST /api/v1/translate
Translates a JSON object of string key-value pairs into a target language. Supports nested JSON (automatically flattened and rebuilt), placeholder preservation, tone control, and protected terms.
https://localify.eeiae.com/api/v1/translatecurl -X POST https://localify.eeiae.com/api/v1/translate \
-H "Authorization: Bearer lfy_..." \
-H "Content-Type: application/json" \
-d '{
"strings": { "save": "Save", "cancel": "Cancel" },
"targetLanguage": "Turkish"
}'Request body
stringsrequiredtargetLanguagerequiredsourceLanguagetonecontextprotectedTermsFull request example:
{
"strings": {
"auth": {
"login": "Log in",
"logout": "Log out",
"welcome": "Welcome back, {name}!"
},
"errors": {
"notFound": "Page not found",
"serverError": "Something went wrong"
}
},
"targetLanguage": "German",
"sourceLanguage": "English",
"tone": "formal",
"context": "B2B SaaS dashboard",
"protectedTerms": ["Localify", "API"]
}Response
On success, returns 200 OK with the translated strings and usage metadata. The translated object mirrors the input structure exactly — nested objects are preserved.
{
"translated": {
"auth": {
"login": "Anmelden",
"logout": "Abmelden",
"welcome": "Willkommen zurück, {name}!"
},
"errors": {
"notFound": "Seite nicht gefunden",
"serverError": "Etwas ist schiefgelaufen"
}
},
"meta": {
"used": 5,
"limit": 5000,
"plan": "starter",
"strings": 5
}
}translatedmeta.usedmeta.limitmeta.planmeta.stringsErrors
All errors return a JSON object with an error string field.
{ "error": "Monthly limit reached (500 strings on free plan)" }Rate limits & quotas
Usage is counted by the number of string key-value pairs translated, not by characters or tokens.
Quotas reset on the 1st of each month. One request can contain up to 2,000 strings. There is no per-minute rate limit beyond the monthly quota.
Need a higher limit? Contact us for a custom plan.
Examples
Node.js — translate on every build
// translate.mjs — run after build
import { readFileSync, writeFileSync } from "fs";
const API = "https://localify.eeiae.com/api/v1/translate";
const KEY = process.env.LOCALIFY_API_KEY;
async function translate(strings, lang) {
const res = await fetch(API, {
method: "POST",
headers: {
"Authorization": `Bearer ${KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ strings, targetLanguage: lang, tone: "formal" }),
});
if (!res.ok) throw new Error(`${lang}: ${(await res.json()).error}`);
const { translated } = await res.json();
writeFileSync(`./locales/${lang.toLowerCase()}.json`, JSON.stringify(translated, null, 2));
console.log(`✓ ${lang}`);
}
const en = JSON.parse(readFileSync("./locales/en.json", "utf8"));
await Promise.all(["Turkish", "German", "French"].map(l => translate(en, l)));GitHub Actions — auto-translate on push
name: Auto-translate
on:
push:
paths: ['src/locales/en.json']
jobs:
translate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Translate with Localify
run: |
node -e "
const fs = require('fs');
const KEY = process.env.LOCALIFY_API_KEY;
const strings = JSON.parse(fs.readFileSync('src/locales/en.json'));
const langs = ['Turkish', 'German', 'French', 'Spanish'];
Promise.all(langs.map(async lang => {
const res = await fetch('https://localify.eeiae.com/api/v1/translate', {
method: 'POST',
headers: { Authorization: `Bearer ${KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ strings, targetLanguage: lang }),
});
const { translated } = await res.json();
fs.writeFileSync(`src/locales/${lang.toLowerCase()}.json`, JSON.stringify(translated, null, 2));
}));"
env:
LOCALIFY_API_KEY: ${{ secrets.LOCALIFY_API_KEY }}
- name: Commit translations
run: |
git config user.name "Localify Bot"
git config user.email "bot@localify.eeiae.com"
git add src/locales/
git diff --staged --quiet || git commit -m "chore: auto-translate" && git pushPython — Django / Flask integration
import json, requests, os
API = "https://localify.eeiae.com/api/v1/translate"
KEY = os.environ["LOCALIFY_API_KEY"]
def translate(strings: dict, lang: str) -> dict:
res = requests.post(API, json={
"strings": strings,
"targetLanguage": lang,
"tone": "formal",
"context": "Django web application",
}, headers={"Authorization": f"Bearer {KEY}"})
res.raise_for_status()
data = res.json()
print(f"✓ {lang} — {data['meta']['strings']} strings used")
return data["translated"]
with open("locale/en.json") as f:
en = json.load(f)
for lang in ["Turkish", "German", "French"]:
translated = translate(en, lang)
with open(f"locale/{lang.lower()}.json", "w") as f:
json.dump(translated, f, ensure_ascii=False, indent=2)