mila
PricingGuidesMCPSDKAbout
Sign inSign up
Node.js SDK

A typed client for mila's API

@vennyx/mila wraps mila's full REST API in typed methods -- no more hand-building requests, parsing status codes, or base64-encoding attachments yourself.

Install

npm install @vennyx/mila

One package, zero config

Quick usage

import { MilaClient } from '@vennyx/mila';

const client = new MilaClient({ apiKey });
await client.emails.send({ from, to, subject, text });

Typed from the first line

What you get over raw fetch()

Every request and response is fully typed, from domains down to a single mailbox field. Every non-2xx response throws one MilaApiError instead of forcing you to parse status codes and error bodies by hand. And sending an attachment is just a Buffer -- the SDK handles the base64 encoding mila's API actually expects on the wire.

Every resource, one client

client.<resource>.<method>() for all eight resources the REST API exposes.

domains

List, inspect, and add domains -- create, dnsRecords, diagnostics, and activate cover the full add-a-domain lifecycle.

mailboxes

Create, update, list, and delete mailboxes on a domain.

aliases

Extra addresses that route to one or more destinations.

catchall

Set or clear a domain-wide catch-all destination.

rewrites

Pattern-based local-part rewrite rules.

identities

Send-as and reply-as identities on a mailbox.

forwardings

External forwarding rules, confirmed by the recipient.

emails

Send mail with attachments -- pass a Buffer, the SDK handles the rest.

Install and go

Install and authenticate

Install the package, then construct one client with an API key from Account > API Keys in the panel. By default it talks to https://api.mila.cx -- pass baseUrl to override it.

Handling errors

Every non-2xx response throws a MilaApiError carrying the real HTTP status and response body, so you can branch on err.status instead of parsing anything yourself.

Requirements

Node.js only -- attachment encoding relies on Buffer, so this package doesn't run in a browser or edge runtime as-is.

Sending real HTML email? Pair it with @vennyx/mila-react-template

A separate, bulletproof React component library for building email that actually survives Outlook, Gmail, and Apple Mail -- Outlook-safe buttons, correct dark-mode handling, and a matching plain-text version generated for you. Bilingual (Turkish/English) out of the box.

Install

npm install @vennyx/mila-react-template

Works with this SDK's emails.send()

Get started

Create a mila account, or read the full API and MCP guide for a REST-first walkthrough.

Get startedRead the guide