Guides

Quickstart

This guide creates a project, imports source text, translates missing values, and publishes a bundle.

1. Create an API Key

Create an API key from your Lezu account with these scopes:

i18n:read
i18n:write
translate:read
translate:write
releases:read
releases:write
usage:read

Use the token in API requests:

Authorization: ApiKey lez_...

2. Create a Project

POST /v1/i18n/projects
Authorization: ApiKey lez_...
Content-Type: application/json
{
  "name": "My App",
  "sourceLocale": "en"
}

Save the returned project.id.

Optional: Create a Child Project

If your product has multiple independent translation sets, create a child project below the parent and use the child project id in later import, release, and bundle calls.

POST /v1/i18n/projects/project_123/children
Authorization: ApiKey lez_...
Content-Type: application/json
{
  "name": "My App - Admin"
}

The child inherits the parent’s source locale, target locales, auto-translate setting, and translation tone. Its keys, values, imports, releases, and bundles stay separate.

3. Import and Translate JSON

POST /v1/i18n/projects/project_123/import
Authorization: ApiKey lez_...
Content-Type: application/json
{
  "locale": "en",
  "targetLocales": ["nl", "fr"],
  "translateMissing": true,
  "content": {
    "home": {
      "title": "Welcome back",
      "cta": "Start now"
    }
  }
}

4. Review Values

GET /v1/i18n/projects/project_123/values
Authorization: ApiKey lez_...

Use this response to confirm imported and translated values before publishing.

5. Publish a Release

POST /v1/i18n/projects/project_123/releases
Authorization: ApiKey lez_...
Content-Type: application/json
{
  "environment": "production",
  "version": "1.0.0",
  "reviewedOnly": false,
  "locales": ["en", "nl", "fr"]
}

6. Fetch a Bundle

GET /v1/i18n/bundles/project_123/production/nl

Your app can use data.messages from the returned bundle for localized UI text.

7. Add More Locales Later

Import a new locale and auto-translate in one request:

POST /v1/i18n/projects/project_123/import
Authorization: ApiKey lez_...
Content-Type: application/json
{
  "locale": "de",
  "targetLocales": ["de"],
  "translateMissing": true,
  "content": {
    "home": {
      "title": "Welcome back",
      "cta": "Start now"
    }
  }
}

Then publish a new release and fetch the updated bundle.

8. Check Usage

GET /v1/usage
Authorization: ApiKey lez_...

Returns your translation usage including source characters, target languages, and total translation units.

SDK

Use @lezu/sdk for type-safe API access from Node.js:

import { createLezuClient } from "@lezu/sdk";

const client = createLezuClient({
  baseUrl: "https://api.lezu.app",
  auth: { type: "apiKey", token: "lez_..." }
});

// Create project
const project = await client.request("POST /v1/i18n/projects", {}, {
  body: { name: "My App", sourceLocale: "en" }
});

// Import and translate
await client.request("POST /v1/i18n/projects/:projectId/import",
  { projectId: project.id },
  { body: { locale: "en", targetLocales: ["nl"], translateMissing: true, content: { ... } } }
);

// Fetch bundle
const bundle = await client.fetchBundle(project.id, "production", "nl");