Quickstart

Wait for the OTP. One API call.

Point your app's signup form at a mailsocket inbox, then block on the wait endpoint until the OTP or magic link arrives. No Gmail, no IMAP.

For testing apps you own or are authorized to test. Not for creating accounts on services you don't control.

60-second path (no signup)

One unauthenticated call creates an API key and an inbox. Then send a code to the inbox address and wait for it. No email handy? Send yourself a test code with one more call. The block needs curl and jq and runs as pasted.

curl
# Needs curl and jq. Paste the whole block into bash.
command -v jq >/dev/null || echo "This block needs jq: https://jqlang.org/download/" >&2
# 1. create a key + inbox and keep both in variables
RESP=$(curl -s -X POST "https://dash.mailsocket.app/api/v1/agents/register" \
  -H "Content-Type: application/json" \
  -d '{"name": "my-test"}')
export MAILSOCKET_API_KEY=$(jq -r .data.api_key <<<"$RESP")
INBOX=$(jq -r .data.inbox.id <<<"$RESP")
echo "Inbox address: $(jq -r .data.inbox.address <<<"$RESP")"
# the key (ms_live_...) is shown once; the address is ...@in.inboxpipe.net

# 2. remember the newest message id (0 if the inbox is empty),
#    then email a code to that address. No email handy? Send
#    yourself a test code (it does not go through the mail server):
SINCE=$(curl -s "https://dash.mailsocket.app/api/v1/inboxes/$INBOX/messages/latest" \
  -H "Authorization: Bearer $MAILSOCKET_API_KEY" | jq -r '.data.id // 0')
curl -s -X POST "https://dash.mailsocket.app/api/v1/inboxes/$INBOX/test-code" \
  -H "Authorization: Bearer $MAILSOCKET_API_KEY"
echo

# 3. wait for the code. since=$SINCE matches only mail newer than
#    that message, even if it arrived before this call started
#    (200 = code, 204 = call again with the same since). An empty
#    SINCE (no jq) stops here instead of matching older mail.
curl -s "https://dash.mailsocket.app/api/v1/inboxes/$INBOX/messages/wait?require=otp&since=${SINCE:?no cutoff, install jq and rerun step 2}&timeout=25" \
  -H "Authorization: Bearer $MAILSOCKET_API_KEY"

# Or skip SINCE: start the wait first, then send the email or
# the test code from another shell while the wait is running.
  • The key is shown once and is on the Free plan: 3 inboxes, 1-day message retention, 2 concurrent waits.
  • Registration is limited to 10 keys per hour per IP address.
  • POST /api/v1/inboxes/<id>/test-code puts a sample OTP email straight into your own inbox. It does not go through the mail server, so it works even where you cannot send email. Limit: 5 per inbox and 20 per account per hour.
  • The account has no dashboard login. Start free with an account for a key you manage in the dashboard.

With an account

  1. Create an inbox and an API key. Start free, verify your email, and open the dashboard. Your first inbox is created automatically, and you can create an API key in one click.
  2. Point your signup or test at your inbox address. Addresses look like <key>@in.inboxpipe.net.
  3. Wait for the code. Call GET /api/v1/inboxes/<id>/messages/wait with Authorization: Bearer <key>. The call blocks until the OTP or magic link arrives, then returns it.

The wait endpoint

GET /api/v1/inboxes/{id}/messages/wait blocks until a matching parsed message arrives, or returns 204 when the timeout elapses.

Query parameters

ParamTypeMeaning
timeout seconds (float) How long to block. Default 20. Clamped to [1, 25] server-side.
since ISO-8601 | public_id | unix ts Only messages received strictly after this point match. Default: the request start time, so a code that arrives during the call is caught and an older one is not. Pass since=0 to match messages already in the inbox (the oldest match is returned first), or a message id to continue after it.
require otp | link | any What counts as a match. Default otp. link matches a message with a magic link; any matches either.
min_confidence float 0..1 Only match an OTP whose otp_confidence is at least this. Default 0.0. Ignored for link. otp_confidence is a heuristic score, not a model prediction: a code within 40 characters of a word like “code” or “verification” scores 0.95, a bare number 0.35, so min_confidence=0.9 skips bare numbers.

Responses

StatusBodyMeaning
200 {"data": {...otp, magic_link, subject, from...}} A matching parsed message arrived (the earliest one after since).
204 empty The timeout elapsed with no match. Call again.
404 error body The inbox does not exist or is not yours.
429 error body too_many_wait_requests (your plan's concurrent waits: 2 Free / 10 Pro / 20 Scale / 40 Business) or wait_capacity (service-wide limit). Retry after the Retry-After header.
200 response
{
  "data": {
    "subject": "Your verification code",
    "from": "security@acme.test",
    "otp": "482193",
    "magic_link": null
  }
}

How long a wait blocks

ClientDefaultMaximumBehaviour
REST API (one call)20s25sReturns 204 when the timeout elapses. Your code calls again.
Python / TypeScript SDK60snoneCalls the API in a loop (up to 25s per call) until a match or the total timeout, then raises WaitTimeout.
MCP server (local)60s120sSame loop as the Python SDK.
MCP server (remote)60s55sEach tool call returns within 55s. Call the tool again if nothing has arrived.
n8n node60s300sSame loop; on timeout it errors or returns an empty item.

Mark a message read

PATCH /api/v1/messages/{id} with {"read": true} marks a message read; {"read": false} marks it unread. The body accepts only read.

curl
curl -X PATCH "https://dash.mailsocket.app/api/v1/messages/msg_xxx" \
  -H "Authorization: Bearer ms_live_..." \
  -H "Content-Type: application/json" \
  -d '{"read": true}'
# → 200 {"data": {"id": "msg_xxx", "read": true, ...}}

Code samples

Each sample notes a start point (the time, or the newest message id) before it submits the signup form, then waits for the OTP with that point as since, so an email that arrives before the wait call starts is still matched. Set MAILSOCKET_API_KEY to your API key (export MAILSOCKET_API_KEY=<your key>) and replace inbox_xxx with your inbox id. The SDKs repeat the wait call for you; the raw HTTP samples show that loop.

Python SDK
import os
import time
import requests
from mailsocket import Client

client = Client(os.environ["MAILSOCKET_API_KEY"])
started = time.time()  # before the submit, so a fast email still matches
requests.post("https://app.example.com/signup", json={"email": "you@in.inboxpipe.net"})
result = client.wait_for_otp("inbox_xxx", since=started, timeout=60)  # raises WaitTimeout after 60s
print(result.otp)   # → "482193"
Node / TypeScript SDK
import { MailsocketClient } from "mailsocket-sdk";

const client = new MailsocketClient(process.env.MAILSOCKET_API_KEY);
const started = Date.now() / 1000;  // before the submit, so a fast email still matches
await fetch("https://app.example.com/signup", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "you@in.inboxpipe.net" }),
});
const { otp } = await client.waitForOtp("inbox_xxx", { since: started, timeout: 60_000 });
console.log(otp);   // → "482193"
curl
# 1. remember the newest message id (0 if the inbox is empty; needs jq)
SINCE=$(curl -s "https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/latest" \
  -H "Authorization: Bearer $MAILSOCKET_API_KEY" | jq -r '.data.id // 0')

# 2. submit your signup form with a mailsocket address
curl -X POST https://app.example.com/signup \
  -H "Content-Type: application/json" \
  -d '{"email":"you@in.inboxpipe.net"}'

# 3. wait up to 25s; repeat with the same since while the status is 204
curl "https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/wait?require=otp&since=${SINCE:?no cutoff, install jq and rerun step 1}&timeout=25" \
  -H "Authorization: Bearer $MAILSOCKET_API_KEY"
Python (requests)
import os
import time
import requests

started = time.time()  # before the submit, so a fast email still matches
requests.post("https://app.example.com/signup", json={"email": "you@in.inboxpipe.net"})

deadline = time.monotonic() + 60
otp = None
while otp is None and time.monotonic() < deadline:
    r = requests.get(
        "https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/wait",
        params={"require": "otp", "since": started, "timeout": 25},
        headers={"Authorization": f"Bearer {os.environ['MAILSOCKET_API_KEY']}"},
        timeout=35,
    )
    if r.status_code == 200:
        otp = r.json()["data"]["otp"]   # → "482193"
    elif r.status_code != 204:   # 204 = no code yet, loop again
        r.raise_for_status()
Node / JS (fetch)
// 1. note the time before the submit, so a fast email still matches
const started = Date.now() / 1000;

// 2. submit your signup form with a mailsocket address
await fetch("https://app.example.com/signup", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "you@in.inboxpipe.net" }),
});

// 3. wait up to 25s per call; 204 means no code yet, so call again
const url = new URL("https://dash.mailsocket.app/api/v1/inboxes/inbox_xxx/messages/wait");
url.searchParams.set("require", "otp");
url.searchParams.set("since", String(started));
url.searchParams.set("timeout", "25");
const deadline = Date.now() + 60_000;
let otp = null;
while (otp === null && Date.now() < deadline) {
  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.MAILSOCKET_API_KEY}` },
  });
  if (res.status === 200) otp = (await res.json()).data.otp;   // → "482193"
  else if (res.status !== 204) throw new Error(`wait failed: ${res.status}`);
}

Run it in your E2E suite

A ready-to-copy Playwright example fills a signup form with a mailsocket address and waits for the OTP: examples/playwright/otp-signup.spec.ts. It reads MAILSOCKET_API_KEY, MAILSOCKET_INBOX_ID and MAILSOCKET_INBOX_ADDRESS from the environment. More in Guides.

SDKs & MCP server

Official clients for the API above, with wait_for_otp built in.

Python: install
pip install mailsocket
Python
import time
from mailsocket import Client

client = Client("ms_live_...")
inbox = client.create_inbox()
started = time.time()
# trigger your signup with inbox["address"] here
otp = client.wait_for_otp(inbox["id"], since=started).otp

No email handy? client.send_test_code(inbox["id"]) (since mailsocket 0.3.0) puts a sample code into the inbox without going through the mail server. Call it where the trigger comment is, after started, and the wait returns that code.

Node / TypeScript: install
npm i mailsocket-sdk
Node / TypeScript
import { MailsocketClient } from "mailsocket-sdk";

const client = new MailsocketClient("ms_live_...");
const inbox = await client.createInbox();
const started = Date.now() / 1000;
// trigger your signup with inbox.address here
const { otp } = await client.waitForOtp(inbox.id, { since: started });

No email handy? await client.sendTestCode(inbox.id) (since mailsocket-sdk 0.3.0) does the same: call it where the trigger comment is, after started.

Take started just before you trigger the email and pass it as since: a code that arrives before the wait call starts is still matched, and an older code in a reused inbox is not. Without since, the SDK wait methods match only messages that arrive during the call, so a fast email can be missed. You can also pass the id of the last message you handled, or since=0 to match anything already in the inbox.

AI agents (MCP)
uvx mailsocket-mcp
{
  "mcpServers": {
    "mailsocket": {
      "command": "uvx",
      "args": ["mailsocket-mcp"],
      "env": { "MAILSOCKET_API_KEY": "ms_live_..." }
    }
  }
}

Requires Python 3.10+. Tools: create_inbox, wait_for_otp, wait_for_link, list_inboxes, list_messages, get_latest, delete_inbox, and send_test_code (since mailsocket-mcp 0.4.0). Listed on the Official MCP Registry as app.mailsocket/mailsocket-mcp.

Remote MCP (no install)

The same tools are hosted at https://mcp.mailsocket.app/mcp over Streamable HTTP. Send your key as a header on every request. A key in the URL (?api_key=) is rejected.

Claude Code CLI:

claude mcp add --transport http mailsocket https://mcp.mailsocket.app/mcp \
  --header "Authorization: Bearer $MAILSOCKET_API_KEY"

Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "mailsocket": {
      "url": "https://mcp.mailsocket.app/mcp",
      "headers": { "Authorization": "Bearer ms_live_..." }
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "mailsocket": {
      "type": "http",
      "url": "https://mcp.mailsocket.app/mcp",
      "headers": { "Authorization": "Bearer ms_live_..." }
    }
  }
}

The remote server is stateless, with per-key limits of 10 waits and 8 other calls in flight (your plan’s own concurrent-wait cap still applies). See how long a wait blocks.

Claude.ai, Claude Desktop connectors and Smithery need OAuth, which is planned but not available yet. Use the local stdio server in those clients.

Why addresses use inboxpipe.net

Inbox addresses live on in.inboxpipe.net, not on mailsocket.app. Keeping inbound test mail on its own domain isolates its reputation from the domain we use for our website, account email and support, so a problem with one never takes down the other.

Some signup forms block domains they do not recognise, including new ones. If a form you test rejects the address, use an address the form accepts; custom domains are unavailable while paid plans are paused.

Public inboxes

Inboxes are private. An inbox created with "public": true can also be read without a key at GET /api/v1/public/emails/{address}/messages. This is off by default and only possible on in.inboxpipe.net addresses.

The public response includes otp, magic_link, from, to, cc, subject and received_at for the 20 most recent messages. It never includes the message body, links, OTP context or metadata. Anyone who knows the address can read the codes, so use public inboxes only for demos and shared fixtures, never for real user signups.

More references