{
  "title": "trusted-domains",
  "description": "Manage the domains and addresses whose signed mail is never quarantined, for the organization, a pod or an inbox, from the MachineMail CLI: flags and examples.",
  "canonical": "https://machinemail.dev/docs/cli/commands/trusted-domains",
  "content": {
    "intro": "Domains and addresses the organization, a pod or an inbox trusts: mail they genuinely sign is never quarantined or withheld from agents. Trust never beats a block entry or opens an allow-only scope.",
    "commands": {
      "table": {
        "columns": ["Command", "Summary"],
        "rows": [
          {"Command": "trusted-domains create", "Summary": "Create trusted domain"},
          {"Command": "trusted-domains delete", "Summary": "Delete trusted domain"},
          {"Command": "trusted-domains get", "Summary": "Get trusted domain"},
          {"Command": "trusted-domains list", "Summary": "List trusted domains"},
          {"Command": "trusted-domains preview", "Summary": "Preview trusted domain"},
          {"Command": "trusted-domains update", "Summary": "Update trusted domain"}
        ]
      },
      "global_flags": "Every command also takes the global flags.",
      "trusted-domains create": {
        "description": "Create trusted domain.",
        "details": "Trust a domain (example.com) or one address (invoices@example.com) at this level. Domains are stored in ASCII (punycode) form; responses carry both forms. Adding an entry that exists at this level (the same domain, or the same --client-id) returns it unchanged with 200.",
        "conflicts": "Trust takes effect only on mail that carries a DKIM signature of the trusted domain itself (d= equal to the domain, or a subdomain with --include-subdomains); a block entry always wins over trust, and an allow-only scope still blocks every sender it does not allow.",
        "errors": [
          "_refused with 422: trusted_domain_not_allowed for names anyone can get mail from; confirmation_required for platforms where anyone can write the content.",
          "Refused with 402 plan_limit_exceeded past the organization’s limit."],
        "permission": "Requires the trusted_domain_create permission.",
        "command_example": "machinemail trusted-domains create [flags]",
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Create it in this inbox."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Create it in this pod."},
              {"Field": "--domain <domain>", "Type": "string", "Description": "A domain (example.com) or an exact address (invoices@example.com)."},
              {"Field": "--include-subdomains", "Type": "boolean", "Description": "Also trust mail signed by subdomains."},
              {"Field": "--reason <value>", "Type": "string", "Description": "Why you trust it, for people reading the list."},
              {"Field": "--expires-at <time>", "Type": "string", "Description": "When the entry stops applying."},
              {"Field": "--confirm", "Type": "boolean", "Description": "Required for platforms where anyone can write the content."},
              {"Field": "--client-id <id>", "Type": "string", "Description": "Idempotency key."},
              {"Field": "-d, --data <json|@file|->", "Type": "string", "Description": "Request body as JSON."}
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains create --domain mail.example.com",
          "machinemail trusted-domains create --data @body.json"
        ],
        "api_endpoints": {
          "list": [
            "POST /v0/trusted-domains",
            "POST /v0/inboxes/{inbox_id}/trusted-domains",
            "POST /v0/pods/{pod_id}/trusted-domains"
          ]
        }
      },
      "trusted-domains delete": {
        "description": "Delete trusted domain.",
        "alternative_command": "machinemail trusted-domains rm.",
        "description_detail": "Mail from the domain is judged normally again from now on.",
        "permission": "Requires the trusted_domain_delete permission.",
        "command_example": "machinemail trusted-domains delete <trusted-domain-id> [flags]",
        "arguments": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "<trusted-domain-id>", "Type": "string", "Description": "ID of the entry (td_...)."}
            ]
          }
        },
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Use this inbox's scoped route."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Use this pod's scoped route."}
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains delete <trusted-domain-id>"
        ],
        "api_endpoints": [
          "DELETE /v0/trusted-domains/{trusted_domain_id}",
          "DELETE /v0/inboxes/{inbox_id}/trusted-domains/{trusted_domain_id}",
          "DELETE /v0/pods/{pod_id}/trusted-domains/{trusted_domain_id}"
        ]
      },
      "trusted-domains get": {
        "description": "Get trusted domain.",
        "permission": "Requires the trusted_domain_read permission.",
        "command_example": "machinemail trusted-domains get <trusted-domain-id> [flags]",
        "arguments": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "<trusted-domain-id>", "Type": "string", "Description": "ID of the entry (td_...)."}
            ]
          }
        },
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Only this inbox."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Only this pod."}
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains get <trusted-domain-id>"
        ],
        "api_endpoints": [
          "GET /v0/trusted-domains/{trusted_domain_id}",
          "GET /v0/inboxes/{inbox_id}/trusted-domains/{trusted_domain_id}",
          "GET /v0/pods/{pod_id}/trusted-domains/{trusted_domain_id}"
        ]
      },
      "trusted-domains list": {
        "description": "List trusted domains.",
        "alternative_command": "machinemail trusted-domains ls.",
        "details": "Entries stored at exactly this level.",
        "permission": "Requires the trusted_domain_read permission.",
        "command_example": "machinemail trusted-domains list [flags]",
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Only this inbox."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Only this pod."},
              {"Field": "--limit <n>", "Type": "integer", "Description": "Maximum number of items to return."},
              {"Field": "--page-token <value>", "Type": "string", "Description": "next_page_token from the previous page."},
              {"Field": "--ascending", "Type": "boolean", "Description": "Oldest first."},
              {"Field": "--all", "Type": "boolean", "Description": "Follow next_page_token and return every page."
              }
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains list",
          "machinemail trusted-domains list --all --json | jq '.trusted_domains | length'"
        ],
        "api_endpoints": [
          "GET /v0/trusted-domains",
          "GET /v0/inboxes/{inbox_id}/trusted-domains",
          "GET /v0/pods/{pod_id}/trusted-domains"
        ]
      },
      "trusted-domains preview": {
        "description": "Preview trusted domain.",
        "details": "Without saving anything: whether it is allowed, whether it needs confirm: true, and its warnings.",
        "permission": "Requires the trusted_domain_read permission.",
        "command_example": "machinemail trusted-domains preview [flags]",
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Use this inbox's scoped route."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Use this pod's scoped route."},
              {"Field": "--domain <domain>", "Type": "string", "Description": "A domain (example.com) or an exact address (invoices@example.com)."},
              {"Field": "--include-subdomains", "Type": "boolean", "Description": "As for create."},
              {"Field": "-d, --data <json|@file|->", "Type": "string", "Description": "Request body as JSON."
              }
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains preview --domain mail.example.com"
        ],
        "api_endpoints": {
          "list": [
            "POST /v0/trusted-domains/preview",
            "POST /v0/inboxes/{inbox_id}/trusted-domains/preview",
            "POST /v0/pods/{pod_id}/trusted-domains/preview"
          ]
        }
      },
      "trusted-domains update": {
        "description": "Update trusted domain.",
        "details": "Change --include-subdomains, --reason or --expires-at.",
        "permission": "Requires the trusted_domain_update permission.",
        "command_example": "machinemail trusted-domains update <trusted-domain-id> [flags]",
        "arguments": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "<trusted-domain-id>", "Type": "string", "Description": "ID of the entry (td_...)."}
            ]
          }
        },
        "flags": {
          "table": {
            "columns": ["Field", "Type", "Description"],
            "rows": [
              {"Field": "--inbox <inbox-id>", "Type": "string", "Description": "Use this inbox's scoped route."},
              {"Field": "--pod <pod-id>", "Type": "string", "Description": "Use this pod's scoped route."},
              {"Field": "--include-subdomains", "Type": "boolean", "Description": "Also trust mail signed by subdomains."},
              {"Field": "--confirm", "Type": "boolean", "Description": "Required to turn on --include-subdomains."},
              {"Field": "--reason <value>", "Type": "string | null", "Description": "New reason; null clears it."},
              {"Field": "--expires-at <time>", "Type": "string | null", "Description": "New expiry; null removes it."},
              {"Field": "-d, --data <json|@file|->", "Type": "string", "Description": "Request body as JSON."
              }
            ]
          }
        },
        "examples": [
          "machinemail trusted-domains update <trusted-domain-id>"
        ],
        "api_endpoints": [
          "PATCH /v0/trusted-domains/{trusted_domain_id}",
          "PATCH /v0/inboxes/{inbox_id}/trusted-domains/{trusted_domain_id}",
          "PATCH /v0/pods/{pod_id}/trusted-domains/{trusted_domain_id}"
        ]
      }
    }
  }
}
