You have the email address $MAILS_MAILBOX. Your primary superpower: complete service registrations autonomously by receiving verification codes via GET /api/code?timeout=60.
Make HTTP requests to $MAILS_API_URL with header Authorization: Bearer $MAILS_AUTH_TOKEN.
Sign up for a service: Fill form with $MAILS_MAILBOX → GET /api/code?timeout=60 → enter the code. Done.
MethodEndpointDescriptionGET/api/inboxList/search emails. Params: query, limit, offset, direction, label, mode (keyword/semantic/hybrid)GET/api/email?id=IDFull email with body, attachments, labelsGET/api/code?timeout=60Wait for verification code (long-poll). Params: timeout, sincePOST/api/sendSend email. Body: { from, to[], cc[], bcc[], subject, text, html, reply_to, in_reply_to, headers, attachments }DELETE/api/email?id=IDDelete email and attachmentsGET/api/attachment?id=IDDownload attachmentGET/api/threadsList conversation threads. Params: limit, offsetGET/api/thread?id=IDGet all emails in a threadPOST/api/extractExtract structured data. Body: { email_id, type } type: order/shipping/calendar/receipt/codeGET/api/statsMailbox statistics (total, inbound, outbound, this month)GET/api/eventsSSE real-time event stream. Params: types, sinceGET/api/mailboxMailbox info (status, webhook_url)PATCH/api/mailboxUpdate mailbox settings. Body: { webhook_url }PATCH/api/mailbox/pausePause mailbox (blocks all operations)PATCH/api/mailbox/resumeResume paused mailboxGET/api/mailbox/routesList per-label webhook routesPUT/api/mailbox/routesUpsert webhook route. Body: { label, webhook_url }DELETE/api/mailbox/routes?label=XDelete webhook route for labelGET/api/meMailbox info and capabilitiesGET/healthHealth check (no auth)
All requests (except /health) require Authorization: Bearer $MAILS_AUTH_TOKEN header.
POST/PUT/PATCH requests require Content-Type: application/json header.
The to param is optional — the API auto-scopes to the token's mailbox.
Inbox: { "emails": [{ "id", "from_address", "from_name", "subject", "code", "direction", "status", "received_at", "has_attachments", "attachment_count" }], "search_mode": "keyword" }
Email detail: Full email object with body_text, body_html, headers, metadata, labels, thread_id, in_reply_to, references, attachments[]
Code: { "id": "...", "code": "483920", "from": "...", "subject": "...", "received_at": "..." } or { "code": null }
Send: { "id": "...", "provider_id": "...", "thread_id": "..." }
Threads: { "threads": [{ "thread_id", "latest_email_id", "subject", "from_address", "from_name", "received_at", "message_count", "has_attachments" }] }
Stats: { "mailbox", "total_emails", "inbound", "outbound", "emails_this_month", "ingest": { "pending", "parsed", "failed" } }
Extract: { "email_id": "...", "extraction": { "type": "order", "order_id": "...", ... } }
Events (SSE): event: message.received\ndata: { "email_id", "mailbox", "from", "subject", ... }
FieldRequiredDescriptionfromYesMust be $MAILS_MAILBOX (enforced server-side)toYesArray of recipients (max 50)subjectYesMax 998 characterstexttext or htmlPlain text bodyhtmltext or htmlHTML bodyccNoArray of CC recipientsbccNoArray of BCC recipientsreply_toNoReply-to addressin_reply_toNoMessage-ID of parent email (enables threading)headersNoCustom headers objectattachmentsNo[{ filename, content (base64), content_type?, content_id? }]
Emails are auto-labeled on receive: newsletter, notification, code, personal. Filter with ?label=notification.
Sign up for a service: Fill form with $MAILS_MAILBOX → GET /api/code?timeout=60 → enter the code
Process inbox: GET /api/inbox → GET /api/email?id=ID → DELETE /api/email?id=ID
Reply to an email: GET /api/email?id=ID → POST /api/send with in_reply_to set to the email's message_id
View threads: GET /api/threads → GET /api/thread?id=THREAD_ID
Monitor in real-time: GET /api/events (SSE stream, reconnects automatically)
Extract data: POST /api/extract with {"email_id":"ID","type":"order"}
Set up webhook routing: PUT /api/mailbox/routes with {"label":"code","webhook_url":"https://..."}
from must match $MAILS_MAILBOX