Skip to content
Docs

Reference

Official Emailit libraries for Node.js, PHP, Laravel, Python, Ruby, Go, Java, .NET and Rust, plus the MCP package and how to call the API over plain HTTP.

Updated Oct 1, 2026

Emailit maintains open-source client libraries for nine languages and frameworks. Each one wraps the REST API with typed errors and the same resource names you see in the API reference. If your language isn’t listed, any HTTP client works.

Official libraries

All libraries are MIT-licensed and published from github.com/emailit.

Language Package Install Requires Source
Node.js @emailit/node npm install @emailit/node Node.js 18+ emailit-node
PHP emailit/emailit-php composer require emailit/emailit-php PHP 8.1+ emailit-php
Laravel emailit/emailit-laravel composer require emailit/emailit-laravel Laravel 10, 11 or 12 emailit-laravel
Python emailit pip install emailit Python 3.7+ emailit-python
Ruby emailit bundle add emailit Ruby 3.0+ emailit-ruby
Go github.com/emailit/emailit-go/v2 go get github.com/emailit/emailit-go/v2 Go 1.21+ emailit-go
Java com.emailit:emailit-java Maven or Gradle, see below Java 11+ emailit-java
.NET Emailit dotnet add package Emailit .NET 8+ emailit-dotnet
Rust emailit cargo add emailit Rust 1.85+ and Tokio emailit-rust

For Java, add the dependency with the latest version listed in the repository:

pom.xml
<dependency>
  <groupId>com.emailit</groupId>
  <artifactId>emailit-java</artifactId>
  <version>VERSION</version>
</dependency>
build.gradle
implementation 'com.emailit:emailit-java:VERSION'

Send an email

Every library takes your API key when you create the client. Load it from an environment variable rather than hard-coding it.

JavaScript
import { Emailit } from '@emailit/node';

const emailit = new Emailit(process.env.EMAILIT_API_KEY);

const email = await emailit.emails.send({
  from: 'Acme <hello@acme.com>',
  to: 'ada@example.com',
  subject: 'Welcome to Acme',
  html: '<p>Thanks for signing up.</p>',
});

console.log(email.id);

The from address must be on a verified sending domain. Until your workspace has production access, you can only send to the account emails of workspace members.

What the libraries cover

Each library exposes the same services: emails, domains, API keys, audiences, subscribers, templates, suppressions, email verifications, email verification lists, webhooks, contacts and events. Errors are raised as typed exceptions or error values, for example an authentication error for 401, a rate-limit error for 429 and a validation error for 422, so you can handle each case separately.

Some newer endpoints aren’t wrapped yet, including forwarding an email, campaigns, automations, forms and DMARC reports. The libraries also don’t set the Idempotency-Key header. For those, call the endpoint over HTTP with the same API key, as shown below.

For framework-specific setup, including mail transports, webhook routes and SMTP configuration, see the framework guides: Node.js, Next.js, Nuxt, Laravel, PHP, Python, Ruby on Rails, Go, Java, .NET and WordPress.

MCP server package

The open-source @emailit/emailit-mcp package runs an MCP server on your machine so AI assistants can call Emailit with your API key:

Terminal
npx -y @emailit/emailit-mcp

Most people don’t need it: the hosted server at https://api.emailit.com/mcp needs no install. Compare the two in Local MCP server.

@emailit/js is a different package: it’s the browser script that shows Emailit forms on your site, not an API client.

Use the API over HTTP

You don’t need a library. Any HTTP client that can send JSON works:

  • Base URL: https://api.emailit.com/v2
  • Headers: Authorization: Bearer <your API key> and Content-Type: application/json
  • Bodies and responses: JSON

For example, to forward an email with an idempotency key from Node.js without the SDK:

JavaScript
const response = await fetch('https://api.emailit.com/v2/emails/em_4K6oASS7KP9ztzWmSN9ndEu13HW/forward', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.EMAILIT_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'forward-order-1042',
  },
  body: JSON.stringify({ to: 'support@acme.com' }),
});

if (!response.ok) {
  throw new Error(`Emailit returned ${response.status}: ${await response.text()}`);
}

Read Errors and Rate limits before you build your own client, so you handle 4xx responses and retry-after correctly. If your app already speaks SMTP, you can also skip the API entirely and use the SMTP relay.

Community libraries

Emailit doesn’t maintain libraries outside the list above. If you find or build one for another language or framework, review its code before you give it an API key, and prefer a Sending Only key restricted to one domain. Let us know at support@emailit.com or on Discord if you’d like it mentioned here.

Base URL, IDs, errors, pagination and rate limits.
Create the key your library needs.
Templates, attachments, scheduling and tracking.
Verify that webhook requests come from Emailit.

Was this page helpful?

Thanks for the feedback.

Thanks, we read every message.