canonical: https://jentic.com/apis/mailsac.com/mailsac-api

# mailsac API Specification

Jentic publishes the only available OpenAPI specification for mailsac API Specification, keeping it validated and agent-ready. The full Mailsac API exposes 47 endpoints covering address reservation in bulk, message retrieval and statistics, attachment download, custom domain management, account information, and inbound webhooks. It is built around the X-API-Key header and supports websocket message streams alongside the REST surface, making it suitable for high-volume QA harnesses and inbound-mail processing pipelines.

## For AI agents

Drive disposable and reserved Mailsac inboxes at scale: bulk-reserve addresses, fetch messages with attachments, manage owned domains, and receive inbound webhooks. Used by agents that automate email-based workflows and large QA suites.

## Scope

Does not send outbound email, host production user mailboxes, or scan attachments for malware - use for receiving, inspecting, and managing disposable test email only.

## Capabilities

- Bulk-reserve up to 50 enhanced email addresses in a single call
- Validate up to 50 addresses at once before triggering outbound sends
- Fetch attachments by content ID and stream their bytes back to the caller
- Manage owned domains and verify DNS records that route mail to Mailsac
- Star messages so they survive automatic inbox cleanup between test runs
- Subscribe websocket clients to live message arrivals on a reserved address

## Use cases

### High-Volume QA Test Harness

Large continuous-integration suites need hundreds of fresh inboxes per run without rate-limiting smaller fleets. The Mailsac bulk reservation endpoint allocates up to 50 private addresses in a single call and the bulk validation endpoint screens outbound recipient lists in one round trip. Test runners can prepare a clean fleet at the start of a job and release everything at the end, keeping inbox state isolated per run.

Example prompt: Call POST /private-addresses-bulk to reserve 50 addresses, run the test job, then DELETE each address to release the fleet.

### Custom Domain Inbound Mail Capture

Teams that own a domain on Mailsac can receive every message addressed to that domain at any inbox they have not pre-reserved. The domain endpoints expose verification status, MX configuration, and message listings across all inboxes on the domain. This supports inbound-mail features in production apps as well as wide-net QA scenarios where the test address is generated dynamically.

Example prompt: Verify the custom domain on the Mailsac account, list every message delivered to it in the last hour, and forward the parsed bodies to the inbound processor.

### Attachment-Aware Email Processing

Workflows that test PDF receipts, image-based notifications, or signed-document emails need access to the binary parts of a message. The Mailsac attachment endpoints return the list of parts on a message and stream the bytes for any single part by content ID, enabling test runners to assert on attachment count, MIME type, and content directly. Header parsing and raw SMTP retrieval round out the inspection surface.

Example prompt: List attachments on the most recent message, download the PDF part by content ID, and verify the byte-count and MIME type match the expectation.

### AI Agent Inbound-Mail Loop

Agents that handle inbound mail (support routing, automated triage, lead enrichment) need a reliable inbox surface they can poll or subscribe to. Through Jentic the agent searches for the relevant Mailsac operation, loads the input schema, and executes the call with credentials served from your Jentic One instance. Webhooks and websockets remove the need for tight polling loops in agent runtimes.

Example prompt: Use Jentic to register a webhook on the agent's reserved address, then process each inbound payload by extracting subject, sender, and body for triage.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/addresses` | List all enhanced email addresses |
| POST | `/addresses/{email}` | Reserve a private email address |
| POST | `/private-addresses-bulk` | Reserve multiple enhanced addresses |
| GET | `/addresses/{email}/messages` | List messages for an email inbox |
| GET | `/raw/{email}/{messageId}` | Get original SMTP message |
| POST | `/validations/addresses` | Validate up to 50 email addresses |
| GET | `/addresses/{email}/message-count` | Count messages for an email inbox |

## Key resources

- **Addresses** — Reserve, list, update, and release private email addresses; bulk and per-address operations.
- **Messages** — Fetch, count, star, and delete messages; retrieve raw, text, and HTML bodies.
- **Attachments** — List parts on a message and download attachment bytes by content ID.
- **Domains** — Manage owned domains, verify DNS, and list messages across the domain.
- **Account** — Inspect account information, message statistics, and rate metadata.
- **Webhooks** — Register and manage inbound-message webhooks on reserved addresses.
- **Web Sockets** — Subscribe to live message arrivals via Mailsac websocket endpoints.

## Why Jentic

- **Setup:** Wiring the mailsac API by hand means sending your key in the X-API-Key header, targeting the mailsac.com/api host, and tracking its address, message, and validation endpoints yourself. Through Jentic you install once, import mailsac from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** mailsac puts the address in the URL path (`/addresses/{email}/messages`, `/raw/{email}/{messageId}`), so a rule can pin your agent to one test address. You choose the operations it may call, so reserving an address or the bulk private-address create is not included unless you add it.
- **Credential handling:** Your mailsac API key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'read messages for a test address' or 'validate an email address', and Jentic returns the matching mailsac operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Mailsac API** — Smaller 16-endpoint Mailsac spec covering the core inbox-fetch surface.
- **Mailtrap Email Sending API** — Mailtrap provides sandbox SMTP and sending APIs for the same email-testing problem space.
- **Postmark Server API** — Postmark sends transactional mail; Mailsac verifies the resulting message in tests.

## FAQ

### Why is there no official OpenAPI spec for mailsac API Specification?

Mailsac does not publish an OpenAPI specification. Jentic generates and maintains this spec so that AI agents and developers can call mailsac API Specification via structured tooling. It is validated against the live API and kept up to date. Get started with Jentic One, the self-hosted execution layer.

### What authentication does the Mailsac full API use?

Mailsac uses an API key passed in the X-API-Key header (also accepted as a query parameter). Through Jentic the key lives in the encrypted vault and is injected at execute time, so the raw value never reaches the agent runtime.

### Can I reserve many Mailsac addresses at once?

Yes. POST /private-addresses-bulk reserves up to 50 enhanced addresses in a single call, and POST `/validations/addresses` validates up to 50 addresses in one request.

### How do I download an attachment from a Mailsac message?

List the parts on the message via the addresses messages endpoint, then call the attachment-by-content-ID endpoint to stream the bytes for the part you need.

### What are the rate limits for the Mailsac full API?

The OpenAPI spec does not declare numeric rate limits - they are tied to your Mailsac plan. Check the account dashboard at mailsac.com for the current quota before high-volume runs.

### How do I subscribe to inbound messages through Jentic?

Run pip install jentic, search 'register inbound mail webhook', load the schema for POST `/addresses/{email}/webhooks`, and execute with the reserved address and your callback URL. Jentic handles the X-API-Key injection.

### Can I limit what my agent is allowed to do with the Mailsac API?

Yes. Because you run Jentic One yourself, your own rules decide which Mailsac operations and credentials your agent may use. Mailsac puts the inbox address in the URL path, as in `/addresses/{email}/messages` and `/raw/{email}/{messageId}`, so you can pin the agent to a single test address and let it only read messages there. You choose the operations it may call, so reserving an address or the bulk private-address create is excluded unless you explicitly add it.
