Skip to main content

Official Python SDK for the MinuteMail API - 100% API coverage with full feature support.

Project description

MinuteMail Python SDK

Python SDK for automating temporary email workflows in testing and CI/CD environments. Create disposable mailboxes, retrieve emails programmatically, and test email-dependent features without exposing real user data.

Resources:

Installation

pip install minutemail-sdk

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")

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)

Fetch messages from a mailbox

# List all emails in the mailbox
mails = client.list_mails(mailbox_id="your-mailbox-id")
for mail in mails["items"]:
    print(f"From: {mail['from']}, Subject: {mail['subject']}")

# Get full email content
mail = client.get_mail(mailbox_id="your-mailbox-id", mail_id="mail-id")
print("Body:", mail["body"])
print("Has attachments:", mail["hasAttachments"])

Client classes

  • MinuteMailClient: Client for managing mailboxes, reading mail, and deleting data.

Constructor parameters

  • api_key (str, required): Tenant-scoped API key used for all authenticated calls.
  • timeout (float, default 10.0): Per-request timeout in seconds.
  • session (requests.Session, optional): Provide to reuse connections/custom adapters.

MinuteMailClient methods

Mailboxes

  • list_mailboxes() → dict {items:[...]}; returns active mailboxes sorted by createdAt. Auth required.
  • create_mailbox(domain, recoverable=None, tag=None, expires_in=None) → mailbox dict (201).
    • domain (str, required): Domain to use.
    • recoverable (bool, optional): When True, mailbox is archived on delete/expiry.
    • tag (str, optional): Required when recoverable=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 including attachments summaries and hasAttachments.
    • 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 + base64 data.
    • attachment_id (str).
  • delete_attachment(mailbox_id, mail_id, attachment_id)None (204).

Errors

  • Network/timeouts raise TransportError.
  • Non-2xx responses raise APIError with status_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)

Contributing

  1. Create a virtualenv and install: pip install -e .
  2. Run your tests using your API key.

Planned: unit tests against a mocked gateway; semantic versioning for releases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minutemail_sdk-1.0.1.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minutemail_sdk-1.0.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file minutemail_sdk-1.0.1.tar.gz.

File metadata

  • Download URL: minutemail_sdk-1.0.1.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for minutemail_sdk-1.0.1.tar.gz
Algorithm Hash digest
SHA256 046af22a8ab415eaba712f542f502245b898d2a1d05753f7b5e52adc7ceb9ae7
MD5 cbcd2bf8fb103d3211503a26c1950c9d
BLAKE2b-256 6192ff3743929bafb3d000a3435ef6748aa6f0ff0e49c8e89693c4e329690a06

See more details on using hashes here.

File details

Details for the file minutemail_sdk-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: minutemail_sdk-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for minutemail_sdk-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 36f40beadb5f966d60de40ffe4409854cd640b3a36e6163563d555bc782e49a2
MD5 03a8a981d34c0562619bb5c61b9a58c2
BLAKE2b-256 e27b40ccbbb1d020c8ab8e4eadd56c23e4e1df125e271ef29c6b78a0c5755a0d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page