Importing email history
Usemailboxes.imports to create an import job, upload the archive directly, start processing, and wait for completion. Set original_addresses to addresses you used at the old provider so sent mail is classified as outbound. Imports are marked read by default.
wait returns completed, failed, or cancelled jobs; a local timeout does not cancel processing. To stop an active job, call cancel or run inkbox mailbox imports cancel <email> <job-id>. Track the independent messages_imported, messages_skipped_duplicate, messages_failed, and messages_rejected_unsafe counters rather than calculating a percentage. Unsafe messages are rejected while the rest of the import continues when possible.
See Mail imports for polling, limits, job fields, and all endpoints.
Drafting email
Save incomplete email in the Inkbox Console or through REST, reopen it from the same inbox, and send only the revision you reviewed. Drafts autosave in the Console, count toward inbox storage, and stay outside ordinary message, thread, and search results until sent. Connected mail apps share the same Drafts folder. Every API mutation carries a generation so concurrent edits are detected rather than silently overwritten. A send rejected before delivery is attempted leaves the draft editable. If delivery cannot be confirmed, the draft becomes read-only and must be duplicated or deleted instead of retried automatically. See Email drafts for Console, REST, conflict, storage, and mail-app workflows, or the Drafts REST reference for every endpoint and field.Custom email signatures
Give each mailbox its own plain-text or HTML signature on a paid plan. Inkbox adds it automatically to outgoing messages, replies, forwards, and draft sends, including mail sent over SMTP. The signature toggle is separate from the organization’s Sent via Inkbox footer setting. See Custom email signatures to configure a signature in the Console, SDK, CLI, or API.Sending email
The simplest case is a plain-text or HTML email to one or more recipients.Branding footer
Outgoing emails include a short “Sent via Inkbox” footer by default. Organizations on a paid plan can remove it: use the “Email footer” setting on the Inkbox Console Email page, or setremove_branding_footer to true with PUT /api/v1/billing/settings
using an admin API key. On the Free plan the footer always applies, and the
request returns 403.
Threaded replies
When your agent needs to continue a conversation, passin_reply_to_message_id with the RFC 5322 message_id of the message you’re replying to. Inkbox links the reply to the existing thread, so the recipient sees one continuous conversation rather than a new email.
Attachments
Pass attachments to the SDK as base64-encoded content with a filename and MIME type. The CLI reads files directly with repeatable--attach flags.
For an inline image, set its content_id in Python or contentId in TypeScript and reference it from the HTML body as cid:chart1. The CLI uses --inline-image chart1=chart.png with --body-html.
Forwarding
Forward an email you’ve already received (or sent) to someone else. Forwards start a brand-new thread — the recipient sees a fresh conversation, not a continuation of the original. Passmode="wrapped" when you need to preserve fidelity (inline images, calendar invites, complex multipart); the default "inline" renders a Gmail-style preamble with the original body below.
send_email.
Reply to everyone
For a Companion conversation, use the snapshot’s storedreply_to_message_id with reply-all and retain the exact audience, including the sponsor. A different recipient branch or private reply does not inherit that sponsorship. An out-of-cohort Reply-To can make the Companion reply unavailable.
Reply to every visible participant on a message in one call. Inkbox resolves the recipients from the original server-side — the original sender (or its Reply-To) goes in To, the remaining To/Cc recipients go in Cc, and your own mailbox and any BCC recipients are dropped. The reply stays in the original thread, and the subject defaults to "Re: " + original.subject.
send_email.
Tracking opens
Passtrack_opens when sending or forwarding to embed an invisible pixel in the HTML body. The message then reports first_opened_at (the reliable signal) and open_count (an approximate figure — image proxies inflate it and rapid repeat opens deflate it). It needs an HTML body, and the pixel can nudge spam scores.
Reading the inbox
iter_emails() pages through the identity’s entire inbox. Use it in an agent processing loop to handle new messages as they arrive.
iter_unread_emails() and mark messages as read once processed so you don’t handle them twice.
Threads
Every email exchange is grouped into a thread. Useget_thread() to load all messages in a thread at once — for example, to give your LLM full conversation context before generating a reply.
Filtering inbound mail
Control incoming and outgoing mail with filter modes and contact rules on the agent identity, addressed byagent_handle. For a simple shared policy, set mail_filter_mode and omit rule direction. New rules cover both sending and receiving.
Each identity has a mail_filter_mode field with two values:
blacklist(default). Without an exact-address choice, matching block domains deny communication; otherwise it is permitted.whitelist. Without an exact-address choice, matching allow domains permit communication; otherwise it is denied.
exact_email (e.g. jane@acme.example) or domain (e.g. acme.example). Each rule has an action: allow or block. When both match, the exact-address rule takes precedence over the domain rule. The following write examples require an admin API key. You can also manage rules in the Inkbox Console; agent keys cannot create, update, or delete rules.
Most agents start in blacklist mode: accept everyone, add explicit blocks for spam domains or individual bad actors. Switch to whitelist when you want the opposite — locked down by default, with a known allowlist.
Receive broadly, send selectively
With SDK/CLI0.7.3 or later, choose independent defaults. Inbound is from a sender to your agent; outbound is from your agent to a recipient. This example permits unmatched inbound senders and permits outbound mail only to approved addresses. Existing applicable rules still take precedence.
both rules. A successful create can widen an existing rule, so retain the returned ID and direction. See rule consolidation and atomic one-side edits.
Receiving a message does not authorize a reply. Returning to
mail_filter_mode sets both defaults but preserves every rule’s action and direction. Read the effective directional fields rather than reconstructing split state from the shared mode. Response notices can explain that distinction alongside results.
Inspecting mailboxes
Most mail operations go through the identity, but sometimes you need the mailbox resource itself — for example, to search across all its messages. For that, useinkbox.mailboxes. Mailboxes are created and destroyed through the identity surface, and filter mode now lives on the identity as mail_filter_mode; this resource is for reading and search. Webhook delivery is configured separately — see the Webhooks guide.
Use a mail app
Every inbox also speaks IMAP and SMTP, so you can open your agent’s mail in a standard desktop or mobile mail app — handy for watching what an agent is doing, or for replying by hand. You sign in with the inbox address and an identity-scoped API key; reads, archives, deletes, and sent mail stay in sync with the API in both directions. See Use a mail app (IMAP/SMTP) for the connection settings and setup.Retry a message request
The SDK preserves a generated request key during bounded retries. An explicitidempotency_key (Python), idempotencyKey (TypeScript), or --idempotency-key
(CLI) identifies the same intended email across separate calls. A completed retry
returns its original response. Read the message for current delivery status.
See message send retries and ID lookup.
