Bun-first TypeScript client for the cPanel UAPI.
@rsrdev/uapi uses the standard fetch API, ships modern ESM for Node.js, and exposes a base client plus typed service wrappers for documented UAPI modules.
bun add @rsrdev/uapinpm install @rsrdev/uapiimport { CpanelUapiClient } from "@rsrdev/uapi";
const client = new CpanelUapiClient({
baseUrl: "https://host.example.com:2083",
auth: {
kind: "apiToken",
username: "cpanel-user",
token: process.env.CPANEL_UAPI_TOKEN!,
},
});const response = await client.email.createAccount({
email: "support",
password: "super-secret-password",
domain: "example.com",
quota: 1024,
});
console.log(response.result.data);const response = await client.domains.addSubdomain({
domain: "blog",
rootdomain: "example.com",
dir: "public_html/blog",
});
console.log(response.result.status);await client.ftp.addFtp({
user: "deploy",
pass: "super-secret-password",
domain: "example.com",
quota: 1024,
});await client.mysql.createDatabase({
name: "appdb",
});
await client.mysql.createUser({
name: "appuser",
password: "super-secret-password",
});const certs = await client.ssl.listCerts();
console.log(certs.result.data);const zone = await client.dns.lookup({
domain: "example.com",
});
console.log(zone.result.data);const records = await client.dnssec.fetchDsRecords({
domain: "example.com",
});
console.log(records.result.data);const response = await client.execute<{ user: string }>(
"Variables",
"get_user_information",
);
console.log(response.result.data.user);Bun applications resolve the source export directly. Node.js applications resolve the built ESM entry from dist.
bun install
bun run checkbun run docs:map:uapiThis command snapshots the cPanel UAPI documentation into docs/cpanel-uapi/, including a local Markdown mirror, the upstream llms.txt, and a generated map.json index.
The domains service intentionally mirrors the documented UAPI surface in docs/. It supports subdomain creation, documented domain information lookups, temporary-domain operations, and domain capability checks.
Addon-domain and alias-domain creation are not included because no corresponding UAPI endpoints are present in the mirrored spec.