Official Python SDK for the MinuteMail API - 100% API coverage with full feature support.
Project description
MinuteMail Python SDK
Python client for the MinuteMail public API gateway (/v1). It handles auth headers, request wiring, and attachment encoding so you can focus on product logic.
Installation
pip install -e .
Requirements: Python 3.9+ and requests>=2.31.0.
Authentication
Every authenticated call sends Authorization: Bearer <api-key>. Pass your tenant-scoped API key when constructing the client:
from minutemail import MinuteMailClient
client = MinuteMailClient(
api_key="your-api-key",
base_url="https://api.minutemail.cc", # or http://localhost:8080 for local
)
Usage examples
Create and use a mailbox
from minutemail import MinuteMailClient, APIError
client = MinuteMailClient(api_key="your-api-key")
try:
mailbox = client.create_mailbox(
domain="minutemail.cc",
recoverable=True,
tag="onboarding",
expires_in="20m",
)
print("Mailbox address:", mailbox["address"])
except APIError as exc:
print("Request failed:", exc)
Client classes
MinuteMailClient: Production-safe surface for managing mailboxes, reading mail, and deleting data.
Constructor parameters
api_key(str, required): Tenant-scoped API key used for all authenticated calls.base_url(str, defaulthttps://api.minutemail.cc): Gateway origin (no/v1suffix).timeout(float, default10.0): Per-request timeout in seconds.session(requests.Session, optional): Provide to reuse connections/custom adapters.
MinuteMailClient methods (production)
Mailboxes
list_mailboxes()→ dict{items:[...]}; returns active mailboxes sorted bycreatedAt. Auth required.create_mailbox(domain, recoverable=None, tag=None, expires_in=None)→ mailbox dict (201).domain(str, required): Domain to use.recoverable(bool, optional): WhenTrue, mailbox is archived on delete/expiry.tag(str, optional): Required whenrecoverable=True.expires_in(str, optional): TTL like"20m"or"2h".
get_mailbox(mailbox_id)→ mailbox dict.mailbox_id(str, required).
delete_mailbox(mailbox_id)→None(204).mailbox_id(str, required).
Archived mailboxes
list_archived_mailboxes()→ dict{items:[...]}of archived mailbox records.get_archived_mailbox(archived_mailbox_id)→ archived mailbox dict.archived_mailbox_id(str).
reactivate_archived_mailbox(archived_mailbox_id, expires_in=None)→ newly created mailbox dict (201).expires_in(str, optional): TTL for the new mailbox; defaults to service TTL.
delete_archived_mailbox(archived_mailbox_id)→None(204).
Mails
list_mails(mailbox_id)→ dict{items:[...]}newest-first.mailbox_id(str).
get_mail(mailbox_id, mail_id)→ mail dict includingattachmentssummaries andhasAttachments.mail_id(str).
delete_mail(mailbox_id, mail_id)→None(204).
Attachments
list_attachments(mailbox_id, mail_id)→ dict{items:[...]}metadata only.mail_id(str).
get_attachment(mailbox_id, mail_id, attachment_id)→ metadata + base64data.attachment_id(str).
delete_attachment(mailbox_id, mail_id, attachment_id)→None(204).
Health
health()→{"ok":true}. No auth header sent.ready()→ readiness payload. No auth header sent.
Errors
- Network/timeouts raise
TransportError. - Non-2xx responses raise
APIErrorwithstatus_code,error,message, and a stringified response preview.
Example:
from minutemail import APIError
try:
client.delete_mailbox("missing-id")
except APIError as exc:
print(exc.status_code, exc.error, exc.message)
Configuration notes
base_urlshould be the gateway origin (no/v1suffix). Default:https://api.minutemail.cc.expires_inmirrors the API: Go-style durations like15m,2h, or integer minutes.- Attachments: strings are UTF-8 encoded then base64 encoded; override
size_bytesif the decoded size is already known.
Development
- Create a virtualenv and install dependencies:
pip install -e . - Point
base_urlat your running gateway (http://localhost:8080). - Run your scripts/tests using your API key.
Planned: unit tests against a mocked gateway; semantic versioning for releases.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file minutemail_sdk-1.0.0.tar.gz.
File metadata
- Download URL: minutemail_sdk-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d236b4c3f0724bbb617d13bd954d4e9effc05977364178ed9bd8903efd36f31
|
|
| MD5 |
c2ba456fb9f6815e70b916e8a9c706a8
|
|
| BLAKE2b-256 |
01932972cb665509b0c5b8890fc10f35a4ff3489cbea0087d07e2d3bc5585103
|
File details
Details for the file minutemail_sdk-1.0.0-py3-none-any.whl.
File metadata
- Download URL: minutemail_sdk-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7322c2f875c5979baaf6eb2fef2aaa2987d44f9be658284dba2072bb72f32649
|
|
| MD5 |
b520c701f261af3e35b593a40081c3d8
|
|
| BLAKE2b-256 |
84b47d0662b756cfc6d11f5adb7c7af5f4e35a66efc3b76f0dd40cee419b77ce
|