API Reference

Authentication

All API requests require an API key. Include it in the Authorization header:

Authorization: Bearer your-api-key

API keys are scoped to a repository. Generate them from the dashboard under Project Settings > API Keys.

Base URL

https://api.lokalio.io

For self-hosted instances, use your custom domain.

Endpoints

List Projects

GET /api/projects

Returns all projects for your organization.

Response: 200 OK

{
  "projects": [
    {
      "id": "proj_abc123",
      "name": "My App",
      "sourceLanguage": "en",
      "targetLanguages": ["fr", "de", "ja"],
      "createdAt": "2026-01-15T10:30:00Z"
    }
  ]
}

Get Translations

GET /api/projects/:projectId/translations

Returns translations for a specific project.

Query Parameters:

ParameterDescription
langFilter by language code (e.g., fr)
namespaceFilter by namespace

Response: 200 OK

{
  "translations": [
    {
      "key": "app.greeting",
      "sourceValue": "Hello",
      "translations": {
        "fr": "Bonjour",
        "de": "Hallo",
        "ja": "こんにちは"
      }
    }
  ]
}

Translate

POST /api/translate

Send strings for AI translation. Used primarily by the CLI.

Request Body:

{
  "sourceLanguage": "en",
  "targetLanguages": ["fr", "de"],
  "strings": [
    { "key": "app.greeting", "value": "Hello, {name}!" }
  ],
  "context": {
    "description": "SaaS analytics dashboard",
    "tone": "professional",
    "glossary": [
      { "sourceTerm": "Dashboard", "targetTerm": "Tableau de bord", "targetLanguage": "fr" }
    ]
  }
}

Response: 200 OK

{
  "translations": [
    {
      "key": "app.greeting",
      "translations": {
        "fr": "Bonjour, {name} !",
        "de": "Hallo, {name}!"
      }
    }
  ]
}

Rate Limiting

The API enforces rate limits to protect against abuse:

HeaderDescription
X-RateLimit-LimitMaximum requests per window
X-RateLimit-RemainingRemaining requests in current window
X-RateLimit-ResetUnix timestamp when the window resets

When the limit is exceeded, the API returns 429 Too Many Requests.