REST API v1

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.

http
Authorization: Bearer lfy_your_api_key_here
Keep your API key secret. Never expose it in client-side code or public repositories. Regenerate it from Settings if it's compromised.

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.

POSThttps://localify.eeiae.com/api/v1/translate
curl
curl -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

stringsrequired
object
JSON object of key-value pairs to translate. Values must be strings. Supports nested objects — they are flattened, translated, and rebuilt automatically. Maximum 2,000 strings per request.
targetLanguagerequired
string
Target language name. E.g. "Turkish", "German", "French", "Spanish", "Italian", "Portuguese", "Dutch", "Russian", "Japanese", "Chinese", "Arabic".
sourceLanguage
string
Source language name or "auto" (default). E.g. "English". When omitted, the AI auto-detects the source language.
tone
string
"formal" | "casual" | "technical". Controls register. Formal uses Sie/vous/usted, casual uses du/tu/tú. Defaults to neutral/auto.
context
string
Short description of your app to improve translation quality. E.g. "B2B invoicing SaaS dashboard" or "mobile game UI".
protectedTerms
string[]
Array of terms to never translate — kept exactly as written. Useful for brand names, product names, technical terms.

Full request example:

json
{
  "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.

json
{
  "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
  }
}
translated
object
Translated key-value pairs. Structure mirrors the input exactly — nested objects preserved.
meta.used
number
Total strings used this month (including this request).
meta.limit
number
Your plan's monthly string limit.
meta.plan
string
Your current plan: "free" | "starter" | "growth".
meta.strings
number
Number of strings translated in this request.

Errors

All errors return a JSON object with an error string field.

401UnauthorizedMissing or invalid API key.
400Bad RequestMissing required fields (strings, targetLanguage), invalid JSON, or empty strings object.
400Too many stringsRequest contains more than 2,000 strings.
403Limit reachedMonthly string limit reached. Response includes your plan and limit.
500Server errorTranslation failed to parse. Retry the request.
json
{ "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.

Free$0500 strings / month
Starter$29/mo5,000 strings / month
Growth$79/mo20,000 strings / month

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

js
// 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

yaml
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 push

Python — Django / Flask integration

python
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)

Ready to integrate?

Get your API key in seconds — no credit card required.

Get started free