Skip to contentSkip to content
machinemail

import

Copy pods, domains, inboxes, webhooks and allow and block lists from AgentMail into MachineMail with the import agentmail command: flags and examples.

Copy settings from another provider into MachineMail (import agentmail).

CommandSummary
import agentmailCopy AgentMail settings (pods, domains, inboxes, webhooks, lists) into MachineMail

Every command also takes the global flags.

import agentmail

Copy AgentMail settings (pods, domains, inboxes, webhooks, lists) into MachineMail.

Reads your AgentMail account with your AgentMail API key, on this machine, and recreates its settings in the MachineMail organization of your MachineMail key through the public API. Mail is never imported: no threads, messages, drafts or attachments. Nothing at AgentMail is changed: the importer only reads.

The AgentMail key comes from AGENTMAIL_API_KEY, --key-file, or a hidden prompt. It is never accepted as an argument, never printed (it shows as am_us_…abcd) and sent only to AgentMail (api.agentmail.to, or api.agentmail.eu with --region eu; the region is read from the am_us_ / am_eu_ prefix). MachineMail never sees it. A pod- or inbox-scoped key imports only that pod or inbox.

Imported: pods (name, client_id); custom domains (you publish the new DNS records, then switch MX: mail keeps going to AgentMail until you do); inboxes (display name, metadata, client_id, status, pod; custom-domain addresses stay the same, @agentmail.to addresses get the same name on the shared domain, a suggested name when that is taken or reserved, or your --rename); allow and block lists at every level, except AgentMail-managed read-only entries; webhooks, always created disabled, with a new signing secret and event types mapped. Inboxes are created with import_source: agentmail: their inbox.created events are recorded but not sent to webhooks.

Not imported, and listed in the report: API keys (names and scopes, to recreate), polling webhooks, read-only list entries, event types and settings MachineMail has no equivalent for.

Re-running is safe: every object carries a client_id (the AgentMail one, else am:<agentmail id>), so a second run reports already imported and creates nothing. After importing, the command writes an ID map (old to new ids, JSON and CSV) and prints the cutover checklist.

Exit codes: 0 when everything planned was imported (or already was); 1 when the plan limits stopped the import before anything was written, or when some items failed (the error names the limits; --json lists failures); 2 for a usage error; 3 when a key is refused or cannot do the import (for example a pod-scoped MachineMail key with an organization AgentMail key); 5 or 6 when AgentMail kept rate limiting or could not be reached; 130 when interrupted.

shell
machinemail import agentmail [flags]

Flags

--dry-runboolean
Read and plan only: print the plan, write nothing to MachineMail, save no file.
--key-file <path|->string
Read the AgentMail key from this file, or - for stdin (default: AGENTMAIL_API_KEY, else a prompt).

DefaultAGENTMAIL_API_KEY

--region <us|eu>us | eu
AgentMail region (default: from the key prefix am_us_ / am_eu_).

Defaultfrom the key prefix am_us_ / am_eu_

--rename <old=new>string[]
Give an AgentMail inbox this MachineMail address, or a name on the shared domain. Repeat the flag for several values.
--skip <id|address>string[]
Leave out an AgentMail pod, domain, inbox or webhook (its id, address, domain or URL). Repeat the flag for several values.
--map-file <path>string
Where to write the ID map (default agentmail-import-map.json; a .csv is written next to it).

Defaultagentmail-import-map.json

Examples

shell
machinemail import agentmail --dry-run
machinemail import agentmail --key-file ~/agentmail.key
machinemail import agentmail --rename scout@agentmail.to=scout-bot --skip old@agentmail.to
machinemail import agentmail --yes --json > import.json

On this page

0% read