Skip to main content
SDKs, CLI, and REST API reference

PostMX docs built for teams that need answers fast.

Create inboxes, receive real emails, extract OTPs and links, verify webhooks, and get production-grade examples without digging through vague snippets.

Quickest path to value
npm install postmx

import { PostMX } from "postmx";

const postmx = new PostMX(process.env.POSTMX_API_KEY!);
const inbox = await postmx.createInbox({
  label: "signup-test",
  lifecycle_mode: "temporary",
  ttl_minutes: 15,
});

const message = await postmx.waitForMessage(inbox.id);
console.log(message.otp);

PostMX

PostMX lets you create inboxes, receive real emails, extract OTPs and links, and verify webhook deliveries without building your own mail infrastructure.

If you want the fastest path, start with an SDK. If you want something scriptable from a terminal or CI step, use the CLI. If you want raw HTTP control, open the REST API reference.

Start in a few lines

Node.js and TypeScript

npm install postmx
import { PostMX } from "postmx";

async function main() {
const postmx = new PostMX(process.env.POSTMX_API_KEY!);

const inbox = await postmx.createInbox({
label: "signup-test",
lifecycle_mode: "temporary",
ttl_minutes: 15,
});

const message = await postmx.waitForMessage(inbox.id);
console.log(message.otp);
}

main().catch(console.error);

Python

pip install postmx
from postmx import PostMXSync

postmx = PostMXSync("pmx_live_...")
inbox = postmx.create_inbox({
"label": "signup-test",
"lifecycle_mode": "temporary",
"ttl_minutes": 15,
})

message = postmx.wait_for_message(inbox["id"])
print(message["otp"])

CLI

npm install -g postmx-cli
export POSTMX_API_KEY=pmx_live_...
postmx inbox create --label signup-test --lifecycle temporary --ttl 15

Pick your entry point

  • Node.js SDK: Best for backend apps, TypeScript projects, scripts, and test automation.
  • Python SDK: Best for Python backends, async workers, and test suites.
  • CLI: Best for local debugging, shell scripts, and CI jobs.
  • REST API reference: Best when you want raw HTTP control or need the OpenAPI contract directly.

What you can do with PostMX

  • Create temporary inboxes for signup, login, checkout, and password reset tests.
  • List inboxes and inspect recent messages.
  • Fetch only the OTP, only the links, or the plain text body when you do not need the full payload.
  • Wait for a message to arrive without writing your own polling loop.
  • Register webhooks for email.received and verify signatures in your app.