
For Node.js and TypeScript developers: this SDK calls our API for you. It covers all 256 operations, one method per operation: domains, DNS, SMS, E-mail Center, AI, billing, support, servers and the rest. It is generated from the OpenAPI specification, so it keeps up with the API.
What it does
It gives you a Client with one area per part of the API: domains, dns, sms, emailCenter, ai and the others. The API address is already in the SDK.
It works with import and require, and ships TypeScript types. It also handles errors, retries and the Idempotency-Key, and checks webhook signatures.
What you need
Node.js 18 or newer (the SDK uses the built-in fetch). And an API key, created in the API Center of My MozOut.
Installing, step by step
|
|
|
import { Client } from "mozout-sdk"; // or: const { Client } = require("mozout-sdk");
const client = new Client(); // or new Client({ apiKey: "sandbox_..." })
console.log((await client.status.pingGet()).data.status);
If the request comes back without an error, the key and the SDK are working. Sending an SMS, for example, looks like this:
await client.sms.messagesCreate({ number: "+14155550123", text: "Your order is ready." });
| Complete examples are in the examples/ folder of the repository, and every operation is listed in OPERATIONS.md. |
The API key and its permissions
If the key lacks the permission for an operation, the API answers 403 insufficient_scope. Give the key only the permissions of the areas you use: see permissions by area.
Errors arrive as ApiError, with the HTTP status, the code, the message and the correlationId. The most common: 401 unauthorized, 402 insufficient_credit and 429 rate_limited.
Testing without spending
Start with a sandbox_ key: it reads your real data, but writes are simulated and never charge. The X-API-Simulated header, in client.lastResponse, tells you whether a write was simulated.
Good to know
Retries: on 429 and 5xx, the SDK waits and tries again, up to 2 times by default, and follows Retry-After. Where an operation accepts an Idempotency-Key, it creates one itself, so a request is never done twice.
Streaming: in the AI chat, stream: true gives you an async iterator of events.
Webhooks: verifyWebhook checks the signature in the X-Webhook-Signature header.
Help
If the API returns an error you do not understand, open a support ticket and send us the correlation_id, never the key. The code is in the Node.js SDK repository, under the MIT license.
|
Ready to call the API from Node.js? Download the latest release |
|
SEE ALSO |
RECOMMENDED PRODUCT Web hosting with cPanel Domain and SSL included, daily backups and the panel you already know. from KSh858.00/mo (3-year plan, with coupon) See plans |











