01

What you get

Each project gets mailboxes on its own domain: anna@yourbusiness.com, not an address on ours. People read and send in the mail app they already use. Your application reaches the same mailboxes through an API, so it can put an inbox in your product, send receipts and notifications from your own domain, and hear about new mail the moment it arrives.

Your domainOne per project. You prove it is yours with one DNS record; XFiles then lists the rest to publish.
MailboxesOne per person, or a shared mailbox for a team. Aliases, and forwards to any address.
Mail appsApple Mail, Outlook, Thunderbird and phones, with an app password per device: IMAP on 993 and SMTP on 465, both at mail.xfiles.dev.
Your appRead, search, send, reply and forward through a REST API, with threads, folders, drafts and scheduled sending.
AttachmentsSave any attachment into XFiles Storage, or attach a file you already store.
Live eventsNew mail, deliveries, bounces and spam reports arrive as they happen, on the platform's realtime connection.

Where: Every route is under https://platform.xfiles.dev/v1/email and takes your project's API key, the same key as the files API. Keep it on your server: browsers get a short-lived token instead (section 04).

02

Your domain

Register the domain, publish the records XFiles gives you, and it turns active by itself: XFiles checks waiting domains every five minutes. Nothing is set up for a domain until its owner has proven it is theirs.

Register and check
1curl -X POST https://platform.xfiles.dev/v1/email/domain \
2 -H "Authorization: Bearer $XFILES_API_KEY" -H "Content-Type: application/json" \
3 -d '{"name":"yourbusiness.com"}'
4
5# What to publish, each record with its status
6curl https://platform.xfiles.dev/v1/email/domain/dns -H "Authorization: Bearer $XFILES_API_KEY"
7
8# Check now instead of waiting
9curl -X POST https://platform.xfiles.dev/v1/email/domain/verify -H "Authorization: Bearer $XFILES_API_KEY"
1 · OwnershipA TXT record at _xfiles-verify.yourbusiness.com with a token made for your registration. Leave it in place.
2 · Mail recordsMX to mail.xfiles.dev, SPF, the mail server's DKIM key, and three DKIM CNAMEs for outgoing mail. DMARC, a bounce subdomain and mail-app discovery records are recommended.
3 · ActiveOnce every required record passes. Mailboxes can then sign in, send and receive.

One SPF record: If the domain already has an SPF record, add include:amazonses.com to it rather than publishing a second one: a domain with two SPF records fails both.

Endpoints

POST/v1/email/domainserverRegister the domain. The same name again is a retry.
GET/v1/email/domain/dnsserverThe records to publish, as last checked.
POST/v1/email/domain/verifyserverCheck now; sets the domain up and activates it when its records pass.
GET/v1/email/domain/statusserverReady or not, and which records still fail.
PUT/v1/email/domainserverReplace the domain, while it has no mailboxes.
DELETE/v1/email/domainserverRemove it, once it has no mailboxes. Removing a domain never deletes mail.
03

Mailboxes

Create mailboxes from your server. Pass your own user id as externalId, and a retry returns the same mailbox instead of making a second one.

Create a mailbox
1curl -X POST https://platform.xfiles.dev/v1/email/mailboxes \
2 -H "Authorization: Bearer $XFILES_API_KEY" -H "Content-Type: application/json" \
3 -d '{"localPart":"anna","displayName":"Anna Berg","externalId":"user_42"}'
4# → 201 { "mailbox": { "id": "mbx_…", "address": "anna@yourbusiness.com", … }, "created": true }

For a mail app, create an app password for that device. It is shown once and XFiles keeps no copy; revoking it signs that device out. The connection route gives the settings to type in.

Endpoints

POST/v1/email/mailboxesserverA mailbox: localPart, and optionally kind: "shared", a display name, a quota.
GET/v1/email/mailboxesserverThe project's mailboxes, a page at a time.
PATCH/v1/email/mailboxes/:idserverChange its display name, quota or password, or suspend it.
DELETE/v1/email/mailboxes/:idserverStops at once; the mail is kept for 30 days, and restore brings it back.
GET/v1/email/mailboxes/:id/connectionserverIMAP and SMTP settings for mail apps.
POST/v1/email/mailboxes/:id/app-passwordsserverA password for one device, shown once.
PUT/v1/email/mailboxes/:id/membersserverWho sees a shared mailbox in their mail app.
POST/v1/email/aliasesserverAn alias of a mailbox (mailboxId), or a forward to up to 20 addresses (forwardTo).
04

An inbox in your app

Your users' browsers never hold the project key. Your server mints a short-lived token that names the mailboxes this user may open, and with it the browser reads and sends that mail and nothing else: no other mailbox, and no administration.

On your server
1curl -X POST https://platform.xfiles.dev/v1/auth/tokens \
2 -H "Authorization: Bearer $XFILES_API_KEY" -H "Content-Type: application/json" \
3 -d '{"userId":"user_42","scopes":["email","realtime"],"mailboxes":["mbx_7Lq3…"],"ttlSeconds":3600}'
4# → { "token": "eyJ…", "expiresAt": "…" }
inbox.ts
1const base = `https://platform.xfiles.dev/v1/email/mailboxes/${mailboxId}`;
2const headers = { Authorization: `Bearer ${token}` };
3
4const { folders } = await fetch(`${base}/folders`, { headers }).then((r) => r.json());
5const inbox = folders.find((f) => f.role === "inbox");
6
7// Newest first; pass next as cursor for the page after.
8const { messages, next } = await fetch(`${base}/messages?folderId=${inbox.id}&limit=50`, { headers }).then((r) => r.json());

Endpoints

GET/v1/email/mailboxes/:id/foldersserver · tokenInbox, Sent, Drafts, Archive, Junk, Trash and your own, with unread counts.
GET/v1/email/mailboxes/:id/messagesserver · tokenList and search: q, from, unread, hasAttachments, dates, threads=true.
GET/v1/email/mailboxes/:id/messages/:messageIdserver · tokenOne message, with its text, HTML and attachments.
GET/v1/email/mailboxes/:id/threads/:threadIdserver · tokenA conversation.
PATCH/v1/email/mailboxes/:id/messages/:messageIdserver · tokenMark read or flagged, or move to another folder.
DELETE/v1/email/mailboxes/:id/messages/:messageIdserver · tokenTo Trash; from Trash, for good.
GET/v1/email/mailboxes/:id/changes?since=server · tokenEverything since your last state, so an app that was offline for hours catches up with nothing missed.
05

Sending

A mailbox sends as its own address or one of its aliases. Anything else is refused, by the API and by the mail server itself. Add an Idempotency-Key, and a retry returns the first answer without sending twice.

Send
1curl -X POST https://platform.xfiles.dev/v1/email/mailboxes/$MAILBOX/messages \
2 -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
3 -H "Idempotency-Key: order-1042-receipt" \
4 -d '{"to":[{"email":"ana@client.example","name":"Ana"}],"subject":"Your receipt","html":"<p>Thanks for your order!</p>"}'
5# → 202 { "message": { "id": "…", "threadId": "…" }, "delivery": { … } }
queuedWith the mail server.
acceptedThe next server on the way took it. Accepted is not yet delivered.
deliveredThe recipient's mail server confirmed it.
deferredThe receiving server asked to try later; it will be retried.
bouncedThe address does not exist, or its server refused the message.
rejectedRefused before it was sent.
complainedThe recipient reported it as spam.

Endpoints

POST/v1/email/mailboxes/:id/messagesserver · tokenSend now, at sendAt (up to 30 days ahead), or save as a draft with draft: true.
POST/v1/email/mailboxes/:id/messages/:messageId/replyserver · tokenReply in the same thread; all: true copies everyone.
POST/v1/email/mailboxes/:id/messages/:messageId/forwardserver · tokenForward, with the original attached whole.
POST/v1/email/mailboxes/:id/drafts/:messageId/sendserver · tokenSend a draft.
GET/v1/email/mailboxes/:id/deliveries/:deliveryIdserver · tokenEach recipient's status.
06

Attachments

Attachments stream straight through, up to 25 MB a message. Save one into XFiles Storage with one call, as a private file attached to whatever it belongs to, or attach a file you already store when you send.

Endpoints

POST/v1/email/mailboxes/:id/attachments?filename=server · tokenUpload the bytes, then send with attachments: [{ attachmentId, filename, contentType }].
GET/v1/email/mailboxes/:id/messages/:messageId/attachments/:attachmentIdserver · tokenDownload one.
POST/v1/email/mailboxes/:id/messages/:messageId/attachments/:attachmentId/save-to-storageserver · tokenCopy it into XFiles Storage as a new private file.
POST/v1/email/mailboxes/:id/messagesserver · tokenAttach stored files with attachments: [{ fileId }].
07

Live events

Open the realtime connection at wss://platform.xfiles.dev/v1/realtime with the same token and subscribe to email:<mailboxId>. Events say what happened, never what the mail says: fetch the message when one arrives. They are kept, so a dropped connection resumes where it left off.

email.receivedNew mail, from SMTP, a mail app or the API.
email.sentThe mailbox sent a message.
email.deliveredA recipient's mail server confirmed a message.
email.bouncedA message bounced.
email.complainedA recipient reported a message as spam.
email.mailbox.suspendedThe mailbox was suspended; email.mailbox.resumed when it is back.
08

Sending rules

XFiles Email is for one-to-one mail, and for the mail your application sends its own users: sign-in codes, password resets, receipts and notifications. It is not for marketing or bulk mail. The full rules are on the acceptable use page.

Per mailbox200 messages an hour.
Per project2,000 messages a day.
Per message50 recipients and 25 MB.
BouncesA mailbox is suspended automatically when more than 10% of its messages bounce within a day (from 20 messages).
Spam reportsAnd when more than 0.5% are reported as spam within a day.
SuppressionAddresses that bounced or reported you as spam are not mailed again.

When a rule stops you: Over a limit, the API answers 429 with Retry-After. A suspended mailbox answers 403 mailbox_suspended, and email.mailbox.suspended tells your server why.

09

Pricing

Paid from the same prepaid balance as the rest of XFiles, for what you use and nothing else. Each day (UTC) is billed once it is over, with the platform's line in Billing. A mailbox costs from the day it is made until the day it is deleted, and its mail is measured every hour. Receiving mail is not charged.

Mailboxes $0.50/mailbox/moEach mailbox, charged by the day while it exists: receiving, spam filtering, mail apps and the API included. A deleted mailbox stops costing at once.
GB of mail stored $0.10/GB/moThe mail your mailboxes keep, measured every hour and charged by the day.
Recipients $0.30/1k recipientsEach recipient of each message sent, from the API or a mail app. Receiving is not charged.

At a zero balance: Everything keeps working for 7 days. Then sending stops, from the API and from mail apps, while mail keeps arriving and can still be read in mail apps. 30 days after that, the mailboxes switch off: no sign-in, and senders get a bounce. A top-up turns everything back on within minutes, and nothing is deleted.

Building with an AI assistant?

Point it at the complete reference, or connect the MCP server so it can read these docs and use your project.