Skip to content

TypeScript SDK Documentation

The TypeScript SDK documentation is available as interactive HTML documentation.

View TypeScript SDK Documentation

SDK-first & the Gateway Model

Every client in the v0.10 (@ptkl/sdk/beta) surface extends one of exactly two base clients, matching the two gateways the platform exposes:

  • PlatformBaseClient — baseURL = host (default https://lemon.protokol.io). Auth: Authorization: Bearer <token> plus X-Project-Env (dev/live) and X-Project-Uuid. Native platform routes hit /v1/...; proxied services (workflow, sandbox, kortex, transactions, ratchet, …) hit /{service}/.... Env fallbacks in Node: API_HOST, PROJECT_ENV, PROJECT_API_TOKEN, PROJECT_UUID.
  • IntegrationsBaseClient — baseURL = host/luma/integrations. Same auth headers. Fronts REST integration components (payments, mail, DMS, timber, Serbia fiscalization) and the JSON-RPC satellite runtime. Env fallback: INTEGRATION_API.

There is one credential, two transports — no integration or service needs its own credential store or a direct microservice host. A new platform capability is never a new transport: it is a new route group reachable through one of these two clients.

This is also the rule the Protokol Toolkit is built to follow: every ptkl command calls an SDK client that extends one of these two base clients — never raw axios against the platform. If you're writing your own automation against the platform (outside ptkl), follow the same pattern: build on Platform/Integrations (or a client that extends one of the two base clients above) rather than hand-rolling HTTP calls, so auth, env targeting, and gateway routing stay consistent with the rest of the toolchain.

Satellites

The beta SDK exposes the Satellites client for project-level JSON-RPC satellites.

import { Satellites } from '@ptkl/sdk/beta';

const satellites = new Satellites({
  token: process.env.PROJECT_API_TOKEN,
  env: 'dev',
});

await satellites.execute('crm-satellite', 'echo', {
  inputs: { message: 'hello' },
});

For the full concept, schema shape, and JSON-RPC contract, see Satellites.