Skip to content

Translation API

Lexis Pro includes a local REST API server for managing StringTable entries programmatically. The API runs on localhost inside the Unity Editor and exposes CRUD endpoints for localization data.

Designed for:

  • LLM coding tools (Claude Code, ChatGPT, Cursor, Copilot)
  • CI/CD pipelines and build scripts
  • Custom external tooling and automation
  • Content management system integration

Quick Start

  1. Open the Translation API window: Tools > KitStack > Lexis > Translation API
  2. Click Start Server
  3. Verify the API is running:
bash
curl http://127.0.0.1:8200/api/v1/status

Response:

json
{
  "status": "ok",
  "version": "1.3.0",
  "project": "MyGame"
}

Endpoint Reference

All endpoints are prefixed with /api/v1/. The API accepts and returns JSON.

GET /api/v1/status

Returns server health, Lexis version, and project name.

bash
curl http://127.0.0.1:8200/api/v1/status
json
{
  "status": "ok",
  "version": "1.3.0",
  "project": "MyGame"
}

GET /api/v1/locales

Returns all locales configured in LocalizationSettings.

bash
curl http://127.0.0.1:8200/api/v1/locales
json
{
  "locales": [
    { "code": "en", "displayName": "English", "nativeName": "English" },
    { "code": "de", "displayName": "German", "nativeName": "Deutsch" },
    { "code": "ja", "displayName": "Japanese", "nativeName": "日本語" }
  ]
}

GET /api/v1/tables

Returns summary information for all registered string tables.

bash
curl http://127.0.0.1:8200/api/v1/tables
json
{
  "tables": [
    { "tableId": "UI", "entryCount": 42 },
    { "tableId": "Gameplay", "entryCount": 128 }
  ]
}

GET /api/v1/tables/

Returns all entries in a string table with full details.

bash
curl http://127.0.0.1:8200/api/v1/tables/UI
json
{
  "tableId": "UI",
  "entryCount": 2,
  "entries": [
    {
      "key": "ui.welcome",
      "defaultValue": "Welcome back!",
      "comment": "Main menu greeting",
      "context": "main_menu",
      "tags": ["ui"],
      "maxLength": 50,
      "translations": [
        { "localeCode": "en", "value": "Welcome back!" },
        { "localeCode": "de", "value": "Willkommen zurueck!" }
      ]
    }
  ]
}

GET /api/v1/tables/{tableId}/entries/

Returns a single entry by key.

bash
curl http://127.0.0.1:8200/api/v1/tables/UI/entries/ui.welcome
json
{
  "key": "ui.welcome",
  "defaultValue": "Welcome back!",
  "comment": "Main menu greeting",
  "context": "main_menu",
  "tags": ["ui"],
  "maxLength": 50,
  "translations": [
    { "localeCode": "en", "value": "Welcome back!" },
    { "localeCode": "de", "value": "Willkommen zurueck!" }
  ]
}

POST /api/v1/tables/{tableId}/entries

Creates new entries or updates existing ones in batch. If an entry with the given key exists, only non-null fields are overwritten.

bash
curl -X POST http://127.0.0.1:8200/api/v1/tables/UI/entries \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [
      {
        "key": "ui.welcome",
        "defaultValue": "Welcome back, adventurer!",
        "comment": "Shown after first login",
        "translations": [
          { "localeCode": "de", "value": "Willkommen zurueck, Abenteurer!" },
          { "localeCode": "fr", "value": "Bon retour, aventurier!" }
        ]
      },
      {
        "key": "ui.goodbye",
        "defaultValue": "See you later!",
        "translations": [
          { "localeCode": "de", "value": "Bis spaeter!" }
        ]
      }
    ]
  }'
json
{
  "created": 1,
  "updated": 1,
  "total": 2
}

DELETE /api/v1/tables/{tableId}/entries/

Deletes an entry from the string table. The operation is registered with Unity's Undo system.

bash
curl -X DELETE http://127.0.0.1:8200/api/v1/tables/UI/entries/ui.goodbye
json
{
  "deleted": true
}

GET /api/v1/openapi.json

Returns the full OpenAPI 3.0.1 specification for this API. Use this to generate tool definitions for LLM integrations.

bash
curl http://127.0.0.1:8200/api/v1/openapi.json

LLM Integration Examples

Claude Code

Claude Code can interact with your localization data directly using the Translation API. Start the server in Unity, then use curl from Claude Code's tool system:

bash
# List all tables
curl -s http://127.0.0.1:8200/api/v1/tables | jq .

# Read all entries from a table
curl -s http://127.0.0.1:8200/api/v1/tables/UI | jq .

# Add a new entry with translations
curl -s -X POST http://127.0.0.1:8200/api/v1/tables/UI/entries \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [{
      "key": "ui.new_feature",
      "defaultValue": "Try our new feature!",
      "comment": "Feature announcement banner",
      "translations": [
        { "localeCode": "de", "value": "Probiere unser neues Feature!" },
        { "localeCode": "fr", "value": "Essayez notre nouvelle fonctionnalite!" }
      ]
    }]
  }'

Fetching Tool Definitions

LLM tools can fetch the OpenAPI schema to discover available endpoints automatically:

bash
curl -s http://127.0.0.1:8200/api/v1/openapi.json > lexis-api.json

This schema can be used as a tool definition for OpenAI function calling, Anthropic tool use, or any other LLM tool framework that accepts OpenAPI specifications.

Workflow Example

A typical LLM-assisted localization workflow:

  1. Fetch locales to know which languages are configured
  2. Read table entries to understand existing translations
  3. Add or update entries with new translations generated by the LLM
  4. Verify by reading back the updated entries
bash
# Step 1: What languages does this project support?
curl -s http://127.0.0.1:8200/api/v1/locales | jq '.locales[].code'

# Step 2: What entries exist in the UI table?
curl -s http://127.0.0.1:8200/api/v1/tables/UI | jq '.entries[] | {key, defaultValue}'

# Step 3: Add translations for a missing entry
curl -s -X POST http://127.0.0.1:8200/api/v1/tables/UI/entries \
  -H "Content-Type: application/json" \
  -d '{"entries": [{"key": "ui.settings", "defaultValue": "Settings", "translations": [{"localeCode": "de", "value": "Einstellungen"}, {"localeCode": "ja", "value": "設定"}]}]}'

# Step 4: Verify
curl -s http://127.0.0.1:8200/api/v1/tables/UI/entries/ui.settings | jq .

Configuration

SettingDefaultDescription
Port8200The localhost port the API server listens on. Change in the Translation API window.
Auto-startOffWhen enabled, the server starts automatically when Unity opens.

The server binds to 127.0.0.1 (localhost only) and is accessible at http://127.0.0.1:{port}/api/v1/.

Security

  • Localhost only: The server binds exclusively to 127.0.0.1. It is not accessible from other machines on the network.
  • No authentication: Since the server only accepts local connections, no API keys or tokens are required.
  • CORS enabled: Cross-origin requests are allowed to support browser-based tools running on localhost.
  • Editor only: The server runs only inside the Unity Editor. It is not included in runtime builds.
  • Undo support: All write operations (POST, DELETE) are registered with Unity's Undo system, so changes can be reverted.

Error Handling

All errors return a consistent JSON structure:

json
{
  "error": "Human-readable error message",
  "code": "MACHINE_READABLE_CODE",
  "status": 404
}
CodeStatusMeaning
NOT_FOUND404Endpoint, table, or entry does not exist
TABLE_NOT_FOUND404The specified string table was not found
ENTRY_NOT_FOUND404The specified entry key was not found
EMPTY_BODY400POST request has no body
INVALID_JSON400Request body is not valid JSON
EMPTY_ENTRIES400Entries array is empty or missing
NO_SETTINGS500LocalizationSettings asset not found
INTERNAL_ERROR500Unexpected server error

Professional Unity Development Tools