{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/modoboa/json-schema/modoboa-account-schema.json",
  "title": "Account",
  "description": "Add support for user resources.",
  "x-generated": "2026-10-28",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/modoboa-openapi.json#/components/schemas/Account",
  "type": "object",
  "properties": {
    "pk": {
      "type": "integer",
      "readOnly": true,
      "title": "ID"
    },
    "username": {
      "type": "string",
      "maxLength": 254
    },
    "first_name": {
      "type": "string",
      "maxLength": 150
    },
    "last_name": {
      "type": "string",
      "maxLength": 150
    },
    "is_active": {
      "type": "boolean"
    },
    "mailbox": {
      "$ref": "#/$defs/Mailbox"
    },
    "role": {
      "type": "string",
      "description": "Return role.",
      "readOnly": true
    },
    "language": {
      "allOf": [
        {
          "$ref": "#/$defs/LanguageEnum"
        }
      ],
      "description": "Prefered language to display pages.\n\n* `br` - breton\n* `cs` - čeština\n* `de` - deutsch\n* `en` - english\n* `el` - ελληνικά\n* `es` - español\n* `fi` - Suomalainen\n* `fr` - français\n* `it` - italiano\n* `ja` - 日本の\n* `nl` - nederlands\n* `pt` - português\n* `pt-br` - português (BR)\n* `pl` - polski\n* `ro` - Română\n* `ru` - русский\n* `sv` - svenska\n* `tr` - türk\n* `zh-hant` - 中文（台灣）"
    },
    "phone_number": {
      "type": [
        "string",
        "null"
      ],
      "maxLength": 128
    },
    "secondary_email": {
      "nullable": true,
      "description": "An alternative e-mail address, can be used for recovery needs.",
      "oneOf": [
        {
          "type": "string",
          "format": "email",
          "maxLength": 254
        },
        {
          "type": "string",
          "maxLength": 0
        }
      ]
    },
    "domains": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of administered domains (resellers and domain administrators only).",
      "readOnly": true
    },
    "tfa_enabled": {
      "type": "boolean",
      "readOnly": true
    },
    "totp_enabled": {
      "type": "boolean"
    },
    "webauthn_enabled": {
      "type": "boolean"
    },
    "date_joined": {
      "type": "string",
      "format": "date-time"
    },
    "last_login": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "aliases": {
      "type": "array",
      "items": {
        "type": "string",
        "format": "email"
      }
    },
    "possible_actions": {
      "type": "string",
      "readOnly": true
    },
    "resources": {
      "type": "string",
      "readOnly": true
    }
  },
  "required": [
    "aliases",
    "domains",
    "pk",
    "possible_actions",
    "resources",
    "role",
    "tfa_enabled",
    "username"
  ],
  "$defs": {
    "LanguageEnum": {
      "enum": [
        "br",
        "cs",
        "de",
        "en",
        "el",
        "es",
        "fi",
        "fr",
        "it",
        "ja",
        "nl",
        "pt",
        "pt-br",
        "pl",
        "ro",
        "ru",
        "sv",
        "tr",
        "zh-hant"
      ],
      "type": "string",
      "description": "* `br` - breton\n* `cs` - čeština\n* `de` - deutsch\n* `en` - english\n* `el` - ελληνικά\n* `es` - español\n* `fi` - Suomalainen\n* `fr` - français\n* `it` - italiano\n* `ja` - 日本の\n* `nl` - nederlands\n* `pt` - português\n* `pt-br` - português (BR)\n* `pl` - polski\n* `ro` - Română\n* `ru` - русский\n* `sv` - svenska\n* `tr` - türk\n* `zh-hant` - 中文（台灣）"
    },
    "Mailbox": {
      "type": "object",
      "description": "Base mailbox serializer.",
      "properties": {
        "pk": {
          "type": "integer",
          "readOnly": true,
          "title": "ID"
        },
        "full_address": {
          "type": "string",
          "format": "email"
        },
        "use_domain_quota": {
          "type": "boolean"
        },
        "quota": {
          "type": "string"
        },
        "message_limit": {
          "type": [
            "integer",
            "null"
          ],
          "maximum": 9223372036854775807,
          "minimum": 0,
          "format": "int64",
          "title": "Message sending limit",
          "description": "Number of messages this mailbox can send per day"
        },
        "quota_usage": {
          "type": "integer",
          "readOnly": true
        },
        "is_send_only": {
          "type": "boolean"
        },
        "sent_messages_in_percent": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Return number of sent messages as a percentage.",
          "readOnly": true
        }
      },
      "required": [
        "full_address",
        "pk",
        "quota_usage",
        "sent_messages_in_percent"
      ]
    }
  }
}