{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/run402-com/json-schema/run402-com-mailbox-schema.json",
  "title": "Mailbox",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/run402-com-openapi.json#/components/schemas/Mailbox",
  "type": "object",
  "properties": {
    "mailbox_id": {
      "type": "string"
    },
    "address": {
      "type": "string",
      "description": "Current effective primary sender/recipient address. Uses ProjectDomain effective custom mailbox state only; otherwise uses the managed project mail host."
    },
    "managed_address": {
      "type": "string",
      "description": "Stable Run402-managed address for this mailbox. Remains receive-compatible permanently, including after custom-domain activation."
    },
    "slug": {
      "type": "string",
      "description": "Project-scoped email local part."
    },
    "project_id": {
      "$ref": "#/$defs/ProjectId"
    },
    "status": {
      "type": "string",
      "enum": [
        "active",
        "suspended",
        "tombstoned",
        "deleted"
      ]
    },
    "footer_policy": {
      "type": "string",
      "enum": [
        "run402_transparency",
        "none"
      ],
      "description": "Configured outbound footer policy for this mailbox. Defaults to run402_transparency."
    },
    "effective_footer_policy": {
      "type": "string",
      "enum": [
        "run402_transparency",
        "none"
      ],
      "description": "Footer policy that will be applied to sends after tier gating. Prototype-tier projects are always run402_transparency."
    },
    "footer_policy_locked_reason": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "prototype_tier"
      ],
      "description": "Null when configurable; prototype_tier when the project tier forces the Run402 transparency footer."
    },
    "is_default_outbound": {
      "type": "boolean",
      "description": "True when this mailbox is the project's default sender for implicit app/helper email sends."
    },
    "is_auth_sender": {
      "type": "boolean",
      "description": "True when this mailbox is the configured sender for auth magic-link and invite emails."
    },
    "can_send": {
      "type": "boolean",
      "description": "True when the mailbox is active and can currently send outbound email."
    },
    "send_blocked_reason": {
      "type": [
        "string",
        "null"
      ],
      "description": "Machine-readable reason when can_send is false, such as mailbox_suspended or mailbox_deleted."
    },
    "domain_kind": {
      "type": "string",
      "enum": [
        "managed",
        "custom"
      ],
      "description": "Whether the primary address currently uses the Run402-managed project mail host or ProjectDomain effective custom mailbox state."
    },
    "address_domain": {
      "type": "string",
      "description": "Domain portion of the current primary address."
    },
    "managed_domain": {
      "type": "string",
      "description": "Stable Run402-managed project mail domain."
    },
    "custom_domain_ready": {
      "type": "boolean",
      "description": "True when ProjectDomain effective state has custom mailbox addresses active."
    },
    "can_receive": {
      "type": "boolean",
      "description": "True when the mailbox has an inbound route for its current address namespace."
    },
    "sends_today": {
      "type": "integer"
    },
    "unique_recipients": {
      "type": "integer"
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "addresses": {
      "type": "object",
      "description": "Structured primary/managed/custom address state.",
      "properties": {
        "primary": {
          "type": "object",
          "additionalProperties": true
        },
        "managed": {
          "type": "object",
          "additionalProperties": true
        },
        "custom": {
          "type": [
            "object",
            "null"
          ],
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    },
    "inbound_policy": {
      "type": "string",
      "enum": [
        "reply_only",
        "allowlist",
        "open"
      ],
      "description": "First-contact inbound policy. reply_only is the default and preserves the sent-history gate."
    },
    "inbound_allowlist": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Case-insensitive allowlist entries for inbound_policy=allowlist. Supports exact addresses and *@domain wildcards."
    },
    "suspended_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "suspended_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "suspended_evidence": {
      "type": [
        "object",
        "null"
      ],
      "additionalProperties": true
    },
    "next_action": {
      "anyOf": [
        {
          "$ref": "#/$defs/NextAction"
        },
        {
          "type": "null"
        }
      ],
      "description": "Domain repair or recovery action when this mailbox is on managed fallback or suspended."
    }
  },
  "$defs": {
    "NextAction": {
      "type": "object",
      "required": [
        "type"
      ],
      "properties": {
        "type": {
          "type": "string",
          "description": "Advisory machine-readable action type such as retry, authenticate, submit_payment, fund_wallet, renew_tier, check_usage, resume_deploy, edit_request, edit_migration, contact_support, upgrade_client, poll (poll the project events feed — appended when the envelope carries a correlated_platform_incident), or hand_to_member (on a commit/promote response that just activated a public site: show the human urls.site and urls.console, relay Run402's offer to promote the build on @run402com, and ask yes or no — see `credited_as` below). create_app_repo (APP_REPO_NOT_FOUND: POST /projects/v1/:project_id/app-repos { repo_name } before reading, committing or pushing a named repo)."
        },
        "method": {
          "type": "string"
        },
        "path": {
          "type": "string"
        },
        "auth": {
          "type": "string"
        },
        "why": {
          "type": "string"
        },
        "credited_as": {
          "type": [
            "string",
            "null"
          ],
          "description": "`hand_to_member` only. The caller's own live presence name in the project's default room, else that room's most recently active live presence, else `null` — in which case `why` tells the agent that joining the room with a name (`run402 rooms join --name ...`) is how the promotion credits it."
        },
        "body": {
          "type": "object",
          "description": "`hand_to_member` only. A ready-to-send `POST /feedback/v1` template: `{ project_id, message: \"promote: yes\", handle? }`."
        }
      },
      "additionalProperties": true
    },
    "ProjectId": {
      "type": "string",
      "description": "Run402 project ID. Public IDs are not UUIDs.",
      "pattern": "^prj_[A-Za-z0-9_-]+$"
    }
  }
}