codeAPI Reference

Complete API documentation for Mailtrap email infrastructure

Welcome to the Mailtrap API documentation. Our APIs provide comprehensive access to email sending, testing, contact management, and account administration features.

Available APIs

Send transactional and bulk emails with reliable delivery.

  • Transactional emails

  • Bulk campaigns

  • Email templates

  • Domain management

Test emails safely in isolated environments.

  • Test inboxes

  • Email inspection

  • SMTP testing

  • API automation

Manage contacts and marketing campaigns.

  • Contact management

  • List segmentation

  • Import/export

  • Event tracking

Receive real-time event notifications.

  • Delivery events

  • Engagement tracking

  • Bounce handling

  • Custom processing

Create reusable email designs.

  • Dynamic content

  • Variable substitution

  • Version control

  • A/B testing

Control users and settings.

  • User permissions

  • Billing management

  • Security settings

  • Audit logs

Quick Start

1

Get API Credentials

  1. Generate a new API token with required permissions

2

Install SDK

Choose your preferred programming language:

npm install mailtrap
3

Send First Email

import { MailtrapClient } from "mailtrap";

const mailtrap = new MailtrapClient({
  token: process.env.MAILTRAP_API_KEY, // You can create your API key here https://mailtrap.io/api-tokens
});

mailtrap
  .send({
    from: { name: "Mailtrap Test", email: "[email protected]" },
    to: [{ email: "[email protected]" }],
    subject: "Hello from Mailtrap Node.js",
    text: "Plain text body",
  })
  .then(console.log)
  .catch(console.error);

Next Steps

Choose an API to explore:

circle-check
circle-info

Testing? Use the Email Sandbox to safely test email functionality.

Last updated

Was this helpful?