Developer guide · Temp Mail API
Temp Mail API for automated email testing
Create a temporary receive-only inbox before a test, give the generated address to the system under test, then read the delivered email through REST API or receive-only IMAP.
What you can automate
- Create a 24-hour temporary mailbox.
- List mailboxes created through your API account.
- Read messages from a mailbox.
- Read the latest verification code endpoint.
- Delete a mailbox when the test is finished.
- Read the same mailbox through TLS IMAP at imap.inboxes.run:993.
REST API quick start
The API base URL is https://inboxes.run/api/v1. API requests use a Bearer key generated after sign-in.
import json, os, time, urllib.request
API = "https://inboxes.run/api/v1"
KEY = os.environ["INBOXESRUN_API_KEY"]
def call(path, method="GET", body=None):
data = None if body is None else json.dumps(body).encode()
req = urllib.request.Request(API + path, data=data, method=method, headers={
"Authorization": f"Bearer {KEY}",
"Content-Type": "application/json",
})
with urllib.request.urlopen(req) as response:
return json.load(response)
box = call("/mailboxes", "POST", {})
print("address:", box["address"])
while True:
messages = call(f"/mailboxes/{box['id']}/messages")
print(json.dumps(messages, indent=2))
time.sleep(3)
Endpoints used in a typical test
POST /mailboxes
GET /mailboxes
GET /mailboxes/{id}/messages
GET /mailboxes/{id}/latest-code
DELETE /mailboxes/{id}REST API or IMAP?
Use REST when your test runner wants JSON and simple polling. Use IMAP when the application or test framework already speaks email. Inboxes.Run IMAP is receive-only and read-only.
Important limits
Temporary mailboxes are not permanent email accounts. A normal temporary inbox lives for 24 hours. Current quotas are shown in the API / IMAP area after sign-in. Do not use a temporary address as the only recovery channel for an important long-lived account.
Try it
Open a temporary inbox in the browser for free. For programmatic use, sign in and open API / IMAP to generate an API key and see the current limits.