Docs Node.js SDK
Node.js SDK
The official Node.js / TypeScript client for the Hostsmith Public API. Manage sites, deploy files, and list domains programmatically.
- npm: @hostsmith/sdk
- Source: hostsmith/js-sdk
- License: MIT
- Node.js: 20 or later
Install
npm install @hostsmith/sdk
Quick start
import { Hostsmith } from "@hostsmith/sdk";
const client = new Hostsmith({
accessToken: process.env.HOSTSMITH_ACCESS_TOKEN!,
partition: "us", // "us" or "eu"
});
const { sites } = await client.sites.list();
await client.sites.deploy(sites[0].id, "./dist");
You'll need an OAuth access token - see Authentication for how to obtain one.
Partitions
Hostsmith stores data in regional partitions. Pass partition to the client to pick one:
| Partition | Label | Base URL |
|---|---|---|
us | United States | https://us.api.hostsmith.net |
eu | European Union | https://eu.api.hostsmith.net |
If your token's aud claim names a single partition, you can omit partition and the SDK will default to it.
Further reading
The full API reference, deploy flow, error classes, and dev/staging overrides are documented in the SDK README on GitHub.
