On this page & docs navigation
On this page
Two capability layersLanguage packages and installationDistribution layer: check versions and downloadRuntime layer: connect printing to your business systemIntegration rules and boundariesFAQGetting started
OverviewQuickstartMulti-language integrationVersions & capabilitiesAPI reference
Delivery channelsREST endpointsCommands & parametersPrint parameters & defaultsCommand referenceVersion & download APIMulti-language SDKWebSocket /wsAO remote channelAgent integrationScenarios & practice
ExamplesBest practicesFeature demosRelated pages
Solutionscloud servicePricingOpen source & licenceBack
← Back to homepage Download the client →Integrate Litchio into your system
Officially provides lightweight SDKs for six programming languages: they only wrap public HTTP endpoints, are not bundled into the client installer, require no browser plugin, and inject no scripts into web pages.
Two capability layers
The SDK has two layers; software vendors can use either one as needed.
| Layer | Target | What it does | Client required? |
|---|---|---|---|
| Distribution layer | https://www.litchio.com/api/v1/* | Check the latest release, download the installer or portable ZIP, verify SHA-256 | No |
| Runtime layer | http://127.0.0.1:19861 | Health checks, command allowlist, printing, template printing, queue and status | Yes, the local client must be running |
Language packages and installation
All language packages use only standard libraries, with no third-party runtime dependencies; code and examples live in the same repository.
| Language | Directory | Requirement |
|---|---|---|
| JavaScript / TypeScript | javascript/ | Node.js 18+ with type declarations |
| Python | python/ | Python 3.8+ |
| C# | dotnet/ | .NET 6+ |
| Java | java/ | Java 11+ |
| Go | go/ | Go 1.18+ |
| PHP | php/ | PHP 8.0+ with curl enabled |
Repository: github.com/alaikis/litchio-printer-sdk. License: Mulan PSL v2.
Distribution layer: check versions and download
A typical flow checks the latest release, decides whether to upgrade, downloads the portable ZIP and verifies its SHA-256. The installer currently has no published checksum; use the portable package when integrity verification matters.
import { ReleaseClient } from "@litchio/sdk";
const releases = new ReleaseClient();
const latest = await releases.latest("1.01.000");
if (latest.updateAvailable) {
await releases.downloadTo("portable", "./PipPrinter.zip", {
sha256: latest.release.artifacts.portable.sha256,
});
} from litchio_sdk import ReleaseClient
releases = ReleaseClient()
latest = releases.latest("1.01.000")
if latest["updateAvailable"]:
sha = latest["release"]["artifacts"]["portable"]["sha256"]
releases.download_to("portable", "./PipPrinter.zip", sha256=sha) using Litchio.Sdk;
var releases = new ReleaseClient();
var latest = await releases.LatestAsync("1.01.000");
if (latest.UpdateAvailable == true) {
var sha = latest.Release!.Artifacts!["portable"].Sha256;
await releases.DownloadToAsync("portable", "PipPrinter.zip", sha256: sha);
} var releases = new LitchioClient.ReleaseClient();
var latest = releases.latest("1.01.000");
if (Boolean.TRUE.equals(latest.get("updateAvailable"))) {
releases.downloadTo("portable", "PipPrinter.zip", null, sha);
} releases := litchio.NewReleaseClient("")
latest, err := releases.Latest("1.01.000")
if err == nil && latest.UpdateAvailable != nil && *latest.UpdateAvailable {
a := latest.Release.Artifacts["portable"]
_, err = releases.DownloadTo("portable", "PipPrinter.zip", "", *a.SHA256)
} $releases = new ReleaseClient();
$latest = $releases->latest("1.01.000");
if ($latest["updateAvailable"] ?? false) {
$sha = $latest["release"]["artifacts"]["portable"]["sha256"];
$releases->downloadTo("portable", "PipPrinter.zip", null, $sha);
} The examples above only read public endpoints; no key is required.
Runtime layer: connect printing to your business system
The runtime layer calls the client's embedded local service. If the client has an apiToken configured, pass it to the SDK, which sends it in a request header; never put the token in front-end code.
const printer = new PrinterClient({ token: process.env.LITCHIO_API_TOKEN });
await printer.ensureCommand("TemplatePrint");
const result = await printer.templatePrint({
template: "https://example.com/waybill/100x150.html",
data: { trackingNo: "SF20261127001", qr: "SF20261127001" },
paperKind: "100mm x 150mm"
});
if (result.code !== 200) throw new Error(result.error); printer = PrinterClient(token=os.environ.get("LITCHIO_API_TOKEN"))
printer.ensure_command("TemplatePrint")
result = printer.template_print(
template="https://example.com/waybill/100x150.html",
data={"trackingNo": "SF20261127001", "qr": "SF20261127001"},
paperKind="100mm x 150mm",
)
if result["code"] != 200: raise RuntimeError(result["error"]) var printer = new PrinterClient(token: Environment.GetEnvironmentVariable("LITCHIO_API_TOKEN"));
await printer.EnsureCommandAsync("TemplatePrint");
var result = await printer.TemplatePrintAsync(new {
template = "https://example.com/waybill/100x150.html",
paperKind = "100mm x 150mm"
});
if (result.Code != 200) throw new Exception(result.Error); var printer = new LitchioClient.PrinterClient(System.getenv("LITCHIO_API_TOKEN"));
printer.ensureCommand("TemplatePrint");
var payload = new LinkedHashMap<String, Object>();
payload.put("template", "https://example.com/waybill/100x150.html");
var result = printer.templatePrint(payload);
if (result.code != 200) throw new RuntimeException(result.error); printer := litchio.NewPrinterClient("", os.Getenv("LITCHIO_API_TOKEN"))
if err := printer.EnsureCommand("TemplatePrint"); err != nil { panic(err) }
result, err := printer.TemplatePrint(map[string]interface{}{
"template": "https://example.com/waybill/100x150.html",
"paperKind": "100mm x 150mm",
})
if err != nil || result.Code != 200 { panic("print failed") } $printer = new PrinterClient(null, getenv("LITCHIO_API_TOKEN"));
$printer->ensureCommand("TemplatePrint");
$result = $printer->templatePrint([
"template" => "https://example.com/waybill/100x150.html",
"paperKind" => "100mm x 150mm",
]);
if ($result["code"] !== 200) throw new RuntimeException($result["error"]); Query the command allowlist before calling, so command names are not hardcoded into business code.
Integration rules and boundaries
- The local service returns code / error / data: code 200 means success, read error on failure; there is no msg field.
- Use the unified target field for print sources; legacy aliases path / label / url / file remain compatible.
- Use idempotencyKey to prevent duplicate output; use groupId + groupOrder for ordered batches.
- The website release API is read-only, key-free, and carries no SLA or quota commitment; downloads still point to third-party hosting.
- The local service is intended for the machine itself by default; LAN access requires a token and network isolation, and it must not be exposed to the public Internet.
- The SDK does not install printer drivers or replace the client's local printing capability; driver checks are read-only.
FAQ
Is the SDK bundled into the client installer?
No. The SDK is a separate lightweight library that vendors include in their own systems as needed; the client still ships no built-in JS wrapper and requires no browser plugin.
Does the distribution layer require the client to be installed?
No. The distribution layer only calls the public read-only release and download API and is suitable for WMS, ERP and IT distribution.
Which operating systems does the runtime layer support?
The runtime layer calls the client's local service; the current official client is Windows 64-bit. The SDK itself is cross-platform, but it cannot give local printing capability to a machine without the client.
Is the command list hardcoded in the SDK?
No. The SDK only provides a runtime method to query the command allowlist; the authoritative list is the /api/commands response of the installed version.
What are the license and pricing terms?
The SDK uses the Mulan PSL v2 license, like the client, and is free; cloud capabilities such as central management and compliance auditing are priced separately.