API Overview

API Contracts

Lezu publishes shared TypeScript types for public API requests and responses in @lezu/sdk.

Use these types when building integrations so your code follows the same endpoint contracts as Lezu’s API, dashboard, and docs.

Install From This Workspace

Inside this monorepo, apps can depend on:

{
  "dependencies": {
    "@lezu/sdk": "0.0.0"
  }
}

Response Envelopes

Every successful endpoint returns a data envelope:

import type { ApiResponse, ContractResponse } from "@lezu/sdk";

type Health = ApiResponse<ContractResponse<"GET /health">>;

That maps to:

{
  "data": {
    "service": "lezu-api",
    "environment": "production",
    "version": "production",
    "timestamp": "2026-04-27T00:00:00.000Z"
  },
  "meta": {}
}

Typed Requests

Use ContractRequest for request bodies:

import type { ContractRequest } from "@lezu/sdk";

const request: ContractRequest<"POST /v1/i18n/projects/:projectId/import"> = {
  locale: "en",
  targetLocales: ["nl", "fr"],
  translateMissing: true,
  content: {
    home: {
      title: "Welcome back"
    }
  }
};

Typed Responses

Use ContractResponse for response payloads:

import type { ContractResponse } from "@lezu/sdk";

type ProjectList = ContractResponse<"GET /v1/i18n/projects">;
type TranslationEstimate = ContractResponse<"POST /v1/translate/estimate">;
type DashboardSummary = ContractResponse<"GET /v1/dashboard/summary">;

Why This Matters

Shared contracts reduce drift between:

  • API route handlers
  • Dashboard client code
  • Tests
  • Documentation examples
  • External integrations

When an endpoint changes, the TypeScript compiler can point to the callers and docs examples that need to change with it.