Skip to content

SDKs

Both SDKs are generated from the contract, never written by hand: every operation on the reference is a method, every shape is a type, and a change to the contract is a change to the package. The version says what kind of change: a removed operation, a newly required field or a changed scope is a major; an added operation or a changed shape is a minor; prose is a patch. The changelog lists each one.

Terminal window
npm install alyt-sdk
import { createAlyt } from "alyt-sdk";
const alyt = createAlyt({ apiKey: process.env.ALYT_KEY! });
// Every call answers { data, error, response }; a refusal carries the server's words.
const rooms = await alyt.roomsList({ query: { tenantId, propertyId } });
for (const room of rooms.data?.items ?? []) console.log(room.name);
// Turn on the virtual light: things are addressed by endpoint, commands by capability and key.
await alyt.endpointsCommand({ path: { endpointId }, body: { tenantId, command: "set", payload: { capability: "light", key: "power", value: true } } });

Method names are <noun><Verb> from the operation: devicesList, integrationsConnect, endpointsCommand. Each one’s operationId is on the reference page. The client is a fetch client with no other dependency; pass your own fetch or baseUrl to createAlyt for a self-hosted platform.

Terminal window
pip install alyt-sdk
from alyt_sdk import AuthenticatedClient
from alyt_sdk.api.tenant_service import properties_list
client = AuthenticatedClient(base_url="https://developers.alyt.com/api/v1", token=ALYT_KEY)
page = properties_list.sync(client=client, tenant_id=TENANT)
for prop in page.items:
print(prop.name)

A DEV key (alyt_dev_…) acts in your sandbox as its admin. A LIVE key (alyt_live_…) is issued only for a published connector of yours and acts in the homes that installed it, for that connector’s things and nothing else. Both go in Authorization: Bearer; the SDK sets the header for you.

The packages are published by the platform’s own pipeline from the committed contract (docs/surface/openapi.json), with provenance. To generate a client for another language, take /api/v1/openapi.json to the generator of your choice; the contract carries x-alyt-scope on every operation, the scope a key needs to call it.

Last updated