{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/mail-in-a-box/main/json-schema/mail-in-a-box-mail-alias-upsert-request-schema.json",
  "title": "MailAliasUpsertRequest",
  "description": "Mail alias upsert request.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mailinabox-openapi.yml#/components/schemas/MailAliasUpsertRequest",
  "type": "object",
  "required": [
    "update_if_exists",
    "address",
    "forwards_to",
    "permitted_senders"
  ],
  "properties": {
    "update_if_exists": {
      "type": "integer",
      "format": "int32",
      "minimum": 0,
      "maximum": 1,
      "description": "Set to `1` when updating an alias."
    },
    "address": {
      "$ref": "#/$defs/Email"
    },
    "forwards_to": {
      "type": "string",
      "description": "If adding a regular or catch-all alias, the format needs to be `user@example.com`.\nMultiple address can be separated by newlines or commas.\n\nIf adding a domain alias, the format needs to be `@example.com`.\n"
    },
    "permitted_senders": {
      "type": [
        "string",
        "null"
      ],
      "description": "Mail users that can send mail claiming to be from any address on the alias domain.\nMultiple address can be separated by newlines or commas.\n\nLeave empty to allow any mail user listed in `forwards_to` to send mail claiming to be from any address on the alias domain.\n"
    }
  },
  "$defs": {
    "Email": {
      "type": "string",
      "format": "email",
      "description": "Email format."
    }
  }
}