SDKs

Client libraries for every language

Official Mailpipe SDKs make it easy to integrate email into your application without dealing with raw HTTP. Every SDK is generated from the same OpenAPI spec so they stay in sync with the API.

Available SDKs

Node.js SDK

@mailpipe/sdk
Docs

Full TypeScript support with auto-generated types from the OpenAPI spec.

  • TypeScript types
  • Promise-based API
  • Automatic pagination
  • Webhook helpers
Install
npm install @mailpipe/sdk
Node.js
import { MailpipeClient } from '@mailpipe/sdk';

const client = new MailpipeClient({
  apiKey: process.env.MAILPIPE_API_KEY,
});

// List unread messages
const messages = await client.messages.list({ unread: true });
console.log(messages.data);

Python SDK

mailpipe
Docs

Sync and async clients. Compatible with Python 3.9+ and all major frameworks.

  • Sync & async clients
  • Type hints (PEP 561)
  • Django / FastAPI friendly
  • Retry handling
Install
pip install mailpipe
Python
from mailpipe import MailpipeClient

client = MailpipeClient(api_key=os.environ["MAILPIPE_API_KEY"])

# List unread messages
messages = client.messages.list(unread=True)
for msg in messages.data:
    print(msg.subject)

Go SDK

github.com/mailpipe/mailpipe-go
Docs

Idiomatic Go SDK with context support, zero external dependencies, and complete test coverage.

  • Context-aware
  • Zero dependencies
  • 100% test coverage
  • Structured errors
Install
go get github.com/mailpipe/mailpipe-go
Go
import "github.com/mailpipe/mailpipe-go"

client := mailpipe.NewClient(os.Getenv("MAILPIPE_API_KEY"))

// List unread messages
messages, err := client.Messages.List(ctx, &mailpipe.ListMessagesParams{
    Unread: mailpipe.Bool(true),
})
if err != nil {
    log.Fatal(err)
}

Ruby SDK

mailpipe
Docs

Elegant Ruby SDK with Rails integration helpers and support for Ruby 3.0+.

  • Rails helpers
  • Webhook verification
  • Configurable retries
  • RSpec matchers
Install
gem install mailpipe
Ruby
require 'mailpipe'

client = Mailpipe::Client.new(api_key: ENV['MAILPIPE_API_KEY'])

# List unread messages
messages = client.messages.list(unread: true)
messages.data.each { |msg| puts msg.subject }

Common Concepts

Authentication

All SDKs accept your API key at construction time. Store the key in an environment variable — never hard-code it or commit it to source control.

Environment variable (.env)
MAILPIPE_API_KEY=mp_live_your-api-key-here

Pagination

List endpoints return a paginated response with data, meta.total, meta.limit, meta.offset, and meta.has_more. SDKs expose auto-pagination helpers so you can iterate all results without managing offsets.

Node.js — auto-paginate all messages
// Fetch every message automatically across all pages
for await (const message of client.messages.listAutoPaging()) {
  console.log(message.subject);
}

Error Handling

Every SDK raises a typed error class (e.g. MailpipeError) that includes the HTTP status code and machine-readable error code.

Node.js — error handling
import { MailpipeClient, MailpipeError } from '@mailpipe/sdk';

try {
  const message = await client.messages.get('msg_does_not_exist');
} catch (err) {
  if (err instanceof MailpipeError) {
    console.error(err.status);  // 404
    console.error(err.code);    // "message_not_found"
    console.error(err.message); // "No message found with id msg_does_not_exist"
  }
}

Webhook Verification Helper

Every SDK ships a utility to verify webhook signatures so you do not have to implement HMAC verification yourself.

Node.js — webhook verification
import { verifyWebhookSignature } from '@mailpipe/sdk';

app.post('/webhooks/mailpipe', (req, res) => {
  const event = verifyWebhookSignature(
    req.rawBody,
    req.headers['x-mailpipe-signature'],
    process.env.MAILPIPE_WEBHOOK_SECRET,
  );
  // event is fully typed — TypeScript knows the shape of event.data
  // based on event.type
  console.log(event.type); // "email.received"
  res.sendStatus(200);
});

Language Guides

OpenAPI Specification

All SDKs are generated from the Mailpipe OpenAPI 3.1 specification. If your language is not listed above you can generate a client from the spec using any OpenAPI code generator.

Download the spec
curl -o mailpipe-openapi.json \
  "https://api.mailpipe.dev/openapi.json"

Or browse the interactive spec at api.mailpipe.dev/docs.

Need Help?

Our team is here to help. Reach out if you have any questions.

Contact Support