{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/planka/main/json-schema/planka-user-schema.json",
  "title": "User",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/planka-openapi.json#/components/schemas/User",
  "type": "object",
  "required": [
    "id",
    "role",
    "name",
    "username",
    "avatar",
    "phone",
    "organization",
    "isDeactivated",
    "createdAt",
    "updatedAt"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for the user"
    },
    "email": {
      "type": "string",
      "format": "email",
      "description": "Email address for login and notifications (private field)"
    },
    "role": {
      "type": "string",
      "enum": [
        "admin",
        "projectOwner",
        "boardUser"
      ],
      "description": "User role defining access permissions"
    },
    "name": {
      "type": "string",
      "description": "Full display name of the user"
    },
    "username": {
      "type": [
        "string",
        "null"
      ],
      "minLength": 3,
      "maxLength": 64,
      "pattern": "^[a-z0-9._-]*$",
      "description": "Unique username for user identification"
    },
    "avatar": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "url",
        "thumbnailUrls"
      ],
      "description": "Avatar information for the user with generated URLs",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "URL to the full-size avatar image"
        },
        "thumbnailUrls": {
          "type": "object",
          "required": [
            "cover180"
          ],
          "description": "URLs for different thumbnail sizes",
          "properties": {
            "cover180": {
              "type": "string",
              "format": "uri",
              "description": "URL for 180px thumbnail version"
            }
          }
        }
      }
    },
    "gravatarUrl": {
      "type": "string",
      "format": "uri",
      "description": "Gravatar URL for the user (conditionally added if configured)"
    },
    "phone": {
      "type": [
        "string",
        "null"
      ],
      "description": "Contact phone number"
    },
    "organization": {
      "type": [
        "string",
        "null"
      ],
      "description": "Organization or company name"
    },
    "language": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "ar-YE",
        "bg-BG",
        "ca-ES",
        "cs-CZ",
        "da-DK",
        "de-DE",
        "el-GR",
        "en-GB",
        "en-US",
        "es-ES",
        "et-EE",
        "fa-IR",
        "fi-FI",
        "fr-FR",
        "hu-HU",
        "id-ID",
        "it-IT",
        "ja-JP",
        "ko-KR",
        "nl-NL",
        "pl-PL",
        "pt-BR",
        "pt-PT",
        "ro-RO",
        "ru-RU",
        "sk-SK",
        "sr-Cyrl-RS",
        "sr-Latn-RS",
        "sv-SE",
        "tr-TR",
        "uk-UA",
        "uz-UZ",
        "vi-VN",
        "zh-CN",
        "zh-TW"
      ],
      "description": "Preferred language for user interface and notifications (personal field)"
    },
    "apiKeyPrefix": {
      "type": [
        "string",
        "null"
      ],
      "description": "Prefix of the API key for display purposes (private field)"
    },
    "subscribeToOwnCards": {
      "type": "boolean",
      "default": false,
      "description": "Whether the user subscribes to their own cards (personal field)"
    },
    "subscribeToCardWhenCommenting": {
      "type": "boolean",
      "default": true,
      "description": "Whether the user subscribes to cards when commenting (personal field)"
    },
    "turnOffRecentCardHighlighting": {
      "type": "boolean",
      "default": false,
      "description": "Whether recent card highlighting is disabled (personal field)"
    },
    "enableFavoritesByDefault": {
      "type": "boolean",
      "default": true,
      "description": "Whether favorites are enabled by default (personal field)"
    },
    "defaultEditorMode": {
      "type": "string",
      "enum": [
        "wysiwyg",
        "markup"
      ],
      "default": "wysiwyg",
      "description": "Default markdown editor mode (personal field)"
    },
    "defaultHomeView": {
      "type": "string",
      "enum": [
        "gridProjects",
        "groupedProjects"
      ],
      "default": "groupedProjects",
      "description": "Default view mode for the home page (personal field)"
    },
    "defaultProjectsOrder": {
      "type": "string",
      "enum": [
        "byDefault",
        "alphabetically",
        "byCreationTime"
      ],
      "default": "byDefault",
      "description": "Default sort order for projects display (personal field)"
    },
    "isSsoUser": {
      "type": "boolean",
      "default": false,
      "description": "Whether the user is SSO user (private field)"
    },
    "isDeactivated": {
      "type": "boolean",
      "default": false,
      "description": "Whether the user account is deactivated and cannot log in"
    },
    "isDefaultAdmin": {
      "type": "boolean",
      "description": "Whether the user is the default admin (visible only to current user or admin)"
    },
    "lockedFieldNames": {
      "type": "array",
      "description": "List of fields locked from editing (visible only to current user or admin)",
      "items": {
        "type": "string"
      }
    },
    "createdAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the user was created"
    },
    "updatedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the user was last updated"
    }
  }
}