Skip to content

SDKs

All seven SDKs are thin, hand-written clients over the REST API with the same surface. They cover the calls a test suite makes; anything else is a plain HTTP request with the same bearer key.

Node 18 or newer, or any runtime with fetch.

Terminal window
npm install --save-dev @mailcatchr/sdk
import { createClient } from "@mailcatchr/sdk";
const mc = createClient({ apiKey: process.env.MAILCATCHR_API_KEY! });
Method Calls
mc.mailboxes.list() GET /v1/mailboxes
mc.mailboxes.create(workspaceId, { name, retentionDays?, groupId? }) POST /v1/workspaces/{id}/mailboxes/
mc.messages.list(mailboxId, { limit?, before? }) GET /v1/mailboxes/{id}/messages
mc.messages.get(mailboxId, messageId) GET /v1/mailboxes/{id}/messages/{id}
mc.messages.await(mailboxId, { to?, subject?, from?, since?, timeoutSeconds? }) GET …/messages/await; resolves to null on timeout
mc.send(mailboxId, { from, to, subject, textBody?, htmlBody?, cc?, bcc?, replyTo? }) POST /v1/mailboxes/{id}/send
mc.totps.code(totpId) GET /v1/totp/{id}/code

Pass baseUrl to target another host and fetch to inject a polyfill or a mock. Errors throw MailcatchrApiError with the HTTP status and the parsed error body.

.NET 8 or newer.

Terminal window
dotnet add package Mailcatchr.Sdk
using var mc = new MailcatchrClient(new MailcatchrClientOptions { ApiKey = apiKey });
Method Calls
ListMailboxesAsync() GET /v1/mailboxes
CreateMailboxAsync(workspaceId, name, retentionDays?, groupId?) POST /v1/workspaces/{id}/mailboxes/
ListMessagesAsync(mailboxId, limit?, before?) GET /v1/mailboxes/{id}/messages
GetMessageAsync(mailboxId, messageId) GET /v1/mailboxes/{id}/messages/{id}
AwaitMessageAsync(mailboxId, subject?, from?, to?, since?, timeout?) GET …/messages/await; returns null on timeout
SendAsync(mailboxId, request) POST /v1/mailboxes/{id}/send
GetTotpCodeAsync(totpId) GET /v1/totp/{id}/code

Webhook interceptors are not wrapped in the C# client yet. Call them with HttpClient and the bearer header; the API reference has the shapes.

Python 3.9 or newer, standard library only.

Terminal window
pip install mailcatchr
from mailcatchr import Client, CreateMailboxRequest, SendRequest
mc = Client(api_key=os.environ["MAILCATCHR_API_KEY"])
Method Calls
mc.mailboxes.list() GET /v1/mailboxes
mc.mailboxes.create(workspace_id, CreateMailboxRequest(name, retention_days?, group_id?)) POST /v1/workspaces/{id}/mailboxes/
mc.messages.list(mailbox_id, limit?, before?) GET /v1/mailboxes/{id}/messages
mc.messages.get(mailbox_id, message_id) GET /v1/mailboxes/{id}/messages/{id}
mc.messages.wait_for(mailbox_id, to?, subject?, from_?, since?, timeout_seconds=30) GET …/messages/await; returns None on timeout
mc.send(mailbox_id, SendRequest(from_, to, subject, text_body?, html_body?, cc?, bcc?, reply_to?)) POST /v1/mailboxes/{id}/send
mc.totps.code(totp_id) GET /v1/totp/{id}/code

Models are frozen dataclasses with snake_case fields; the wire field from is from_. Errors raise MailcatchrApiError with .status and .body. Pass base_url to target another host.

Java 17 or newer. Jackson is the only dependency.

<dependency>
<groupId>com.mailcatchr</groupId>
<artifactId>mailcatchr-sdk</artifactId>
<version>1.0.1</version>
</dependency>
import com.mailcatchr.sdk.MailcatchrClient;
import com.mailcatchr.sdk.Models.*;
var mc = MailcatchrClient.builder(System.getenv("MAILCATCHR_API_KEY")).build();
Method Calls
listMailboxes() GET /v1/mailboxes
createMailbox(workspaceId, CreateMailboxRequest) POST /v1/workspaces/{id}/mailboxes/
listMessages(mailboxId, ListMessagesOptions) GET /v1/mailboxes/{id}/messages
getMessage(mailboxId, messageId) GET /v1/mailboxes/{id}/messages/{id}
awaitMessage(mailboxId, AwaitMessageOptions) GET …/messages/await; returns Optional.empty() on timeout
send(mailboxId, SendRequest) POST /v1/mailboxes/{id}/send
totpCode(totpId) GET /v1/totp/{id}/code

Models are records that ignore unknown fields. Errors throw MailcatchrApiException with status() and body(); connection problems throw MailcatchrIoException. The builder accepts baseUrl, timeout, and your own HttpClient. Kotlin projects use it as is.

Go 1.22 or newer, standard library only.

Terminal window
go get github.com/mailcatchr/mailcatchr-sdk/go
import mailcatchr "github.com/mailcatchr/mailcatchr-sdk/go"
mc := mailcatchr.New(os.Getenv("MAILCATCHR_API_KEY"))
Method Calls
mc.ListMailboxes(ctx) GET /v1/mailboxes
mc.CreateMailbox(ctx, workspaceID, CreateMailboxRequest{...}) POST /v1/workspaces/{id}/mailboxes/
mc.ListMessages(ctx, mailboxID, ListOptions{Limit, Before}) GET /v1/mailboxes/{id}/messages
mc.GetMessage(ctx, mailboxID, messageID) GET /v1/mailboxes/{id}/messages/{id}
mc.AwaitMessage(ctx, mailboxID, AwaitOptions{To, Subject, From, Since, TimeoutSeconds}) GET …/messages/await; returns nil, nil on timeout
mc.Send(ctx, mailboxID, SendRequest{...}) POST /v1/mailboxes/{id}/send
mc.TOTPCode(ctx, totpID) GET /v1/totp/{id}/code

API errors are *mailcatchr.APIError with Status and Body; mailcatchr.IsStatus(err, 404) checks one. Optional request fields are pointers, with mailcatchr.String and mailcatchr.Int helpers. WithBaseURL and WithHTTPClient options.

Ruby 3.0 or newer, standard library only.

gem "mailcatchr"
mc = Mailcatchr::Client.new(api_key: ENV.fetch("MAILCATCHR_API_KEY"))
Method Calls
mc.mailboxes.list GET /v1/mailboxes
mc.mailboxes.create(workspace_id, name:, retention_days:, group_id:) POST /v1/workspaces/{id}/mailboxes/
mc.messages.list(mailbox_id, limit:, before:) GET /v1/mailboxes/{id}/messages
mc.messages.get(mailbox_id, message_id) GET /v1/mailboxes/{id}/messages/{id}
mc.messages.wait_for(mailbox_id, to:, subject:, from:, since:, timeout_seconds:) GET …/messages/await; returns nil on timeout
mc.send_message(mailbox_id, from:, to:, subject:, text_body:, html_body:, ...) POST /v1/mailboxes/{id}/send
mc.totps.code(totp_id) GET /v1/totp/{id}/code

Models are keyword Structs with snake_case fields. Errors raise Mailcatchr::ApiError with status and body.

PHP 8.1 or newer with ext-curl.

Terminal window
composer require --dev mailcatchr/mailcatchr
$mc = new \Mailcatchr\Client(getenv('MAILCATCHR_API_KEY'));
Method Calls
$mc->mailboxes->list() GET /v1/mailboxes
$mc->mailboxes->create($workspaceId, $name, retentionDays:, groupId:) POST /v1/workspaces/{id}/mailboxes/
$mc->messages->list($mailboxId, limit:, before:) GET /v1/mailboxes/{id}/messages
$mc->messages->get($mailboxId, $messageId) GET /v1/mailboxes/{id}/messages/{id}
$mc->messages->waitFor($mailboxId, to:, subject:, from:, since:, timeoutSeconds:) GET …/messages/await; returns null on timeout
$mc->send($mailboxId, $from, $to, $subject, textBody:, htmlBody:, ...) POST /v1/mailboxes/{id}/send
$mc->totps->code($totpId) GET /v1/totp/{id}/code

Models are readonly classes. Errors throw Mailcatchr\ApiException with $status and $body. A transport callable can replace curl in your own tests.

The API is v1 and only changes additively. SDK versions follow semantic versioning against it. A new API field never breaks an older SDK.