Official MozOut TypeScript and Node.js SDK: API client for domains, DNS, VPS, hosting, SMS, email and AI https://docs.mozout.com
  • JavaScript 73.9%
  • TypeScript 26.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-11-28 09:40:26 +02:00
.github Add CI workflow and Dependabot 2026-11-28 09:14:29 +02:00
examples Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
lib Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
CHANGELOG.md Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
LICENSE Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
OPERATIONS.md Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
package.json Initial release (1.0.0) 2026-11-27 22:29:25 +02:00
README.md Add badges and improve description 2026-11-28 09:40:26 +02:00
README.pt.md Add badges and improve description 2026-11-28 09:40:26 +02:00
repo.json Add badges and improve description 2026-11-28 09:40:26 +02:00

MozOut API SDK for Node.js

CI Release License: MIT

A Node.js library for the MozOut API: domains, DNS, SMS, E-mail Center, AI, billing, support, servers and the rest. It covers all 256 operations of the API, one method per operation, and it is generated from the OpenAPI specification, so it keeps up with the API.

Português · All operations

Install

npm install mozout-sdk

Needs Node.js 18 or newer (it uses the built-in fetch). Works with import and require, and ships TypeScript types.

Get started

Create a key in the API Center of My MozOut (docs: https://docs.mozout.com). Start with a sandbox_ key: it reads your real data, but writes are simulated and never charge. Pass the key in the code or in an environment variable: MOZOUT_API_KEY.

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);

The SDK already points to the MozOut API: https://api.mozout.com.

Options: new Client({ apiKey, brand, baseUrl, language: "pt", mode: "sandbox", timeout: 60000, maxRetries: 2 }).

The areas are status, token, actions, specification, sms, emailCenter, account, catalog, domains, whois, services, billing, support, dns, servers, hosting, email, extras, reseller, ai. For example, GET /v1/domains/{domain} is domains.get. The full list is in OPERATIONS.md.

Examples

Register a domain:

const check = await client.domains.availability({ domain: "example.com" });
if (check.data.available) await client.domains.register({ domain: "example.com", years: 1 });

Send an SMS:

await client.sms.messagesCreate({ number: "+14155550123", text: "Your order is ready." });

Send an e-mail with the E-mail Center:

await client.emailCenter.messagesCreate({
  from: "Example <notifications@example.com>",
  to: ["ana@example.org"],
  subject: "Your order is ready",
  text: "Hello Ana, your order is ready to collect.",
});

Chat with the AI:

const answer = await client.ai.chatCreate({
  model: "deepseek-ai/deepseek-v4-flash",
  messages: [{ role: "user", content: "Write a welcome message for our website." }],
});
console.log(answer.choices[0].message.content);

// With stream: true you get an async iterator of events
for await (const ev of await client.ai.chatCreate({ model: "deepseek-ai/deepseek-v4-flash", messages: [{ role: "user", content: "Hello" }], stream: true })) {
  console.log(ev);
}

Complete examples are in the examples/ folder.

Errors, retries and Idempotency-Key

When the API answers with an error, the SDK throws an exception with the HTTP status, the code (it never changes), the message and the correlation_id to give to support. The most common codes: 401 unauthorized (wrong or expired key), 402 insufficient_credit (not enough balance), 403 insufficient_scope (the key lacks the permission) and 429 rate_limited.

import { ApiError } from "mozout-sdk";

try {
  await client.sms.messagesCreate({ number: "+14155550123", text: "Hello" });
} catch (e) {
  if (e instanceof ApiError) console.log(e.status, e.code, e.apiMessage, e.correlationId); // e.g. 402 insufficient_credit
}

On 429 and 5xx the SDK waits and tries again, up to 2 times by default (it follows Retry-After). On operations that accept an Idempotency-Key, the SDK creates one on its own and repeats it on every retry, so a request is never done twice. You can pass your own: { idempotencyKey: "..." }.

The status and headers of the last answer are in client.lastResponse, for example to know whether a write was simulated (X-API-Simulated).

Webhooks

Account events arrive signed in the X-Webhook-Signature header. To check the signature:

import { verifyWebhook } from "mozout-sdk";

const ok = await verifyWebhook(rawBody, req.headers["x-webhook-signature"], secret);

Version

Version 1.0.0, generated from version 1.0.0 of the API specification.


Maintained by RLX Holdings.