{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/zoho/main/json-schema/zoho-update-layout-request-schema.json",
  "title": "UpdateLayoutRequest",
  "description": "Request body for updating a layout. Only a single layout can be updated per request.",
  "x-generated": "2026-10-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/zoho-layouts-api-openapi.yml#/components/schemas/UpdateLayoutRequest",
  "type": "object",
  "required": [
    "layouts"
  ],
  "properties": {
    "layouts": {
      "type": "array",
      "description": "Array containing exactly one layout object with update properties. Only single layout updates are supported per request.",
      "minItems": 1,
      "maxItems": 1,
      "items": {
        "$ref": "#/$defs/LayoutUpdateObject"
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "DeleteObject": {
      "type": "object",
      "description": "Delete configuration object.",
      "required": [
        "permanent"
      ],
      "properties": {
        "permanent": {
          "type": "boolean",
          "description": "If true, permanently deletes the resource. If false, moves it to unused section (for fields)."
        }
      },
      "additionalProperties": false
    },
    "FieldUpdateObject": {
      "type": "object",
      "description": "Field object for adding, updating, creating, or removing fields from a section. For adding an existing field, provide only id. For updating field position, provide id and sequence_number. For creating a new field, provide field_label, data_type, and optionally length and sequence_number. For removing/moving a field, provide id and _delete object.",
      "minProperties": 1,
      "properties": {
        "id": {
          "$ref": "#/$defs/Id",
          "description": "Unique identifier of an existing field. Required when adding, updating position, or removing an existing field. Omit when creating a new custom field."
        },
        "field_label": {
          "type": "string",
          "description": "Display label for the field. Required when creating a new custom field.",
          "minLength": 1,
          "maxLength": 255
        },
        "data_type": {
          "type": "string",
          "description": "Data type of the field. Required when creating a new custom field. Determines the field's input type and validation.",
          "enum": [
            "text",
            "textarea",
            "email",
            "phone",
            "website",
            "integer",
            "bigint",
            "currency",
            "double",
            "percent",
            "date",
            "datetime",
            "boolean",
            "picklist",
            "multiselectpicklist",
            "lookup",
            "multiselectlookup",
            "autonumber",
            "fileupload",
            "imageupload",
            "formula",
            "rollup_summary",
            "consent_lookup",
            "profileimage",
            "richtextarea",
            "userlookup",
            "multiuserlookup",
            "event_reminder"
          ]
        },
        "length": {
          "type": "integer",
          "format": "int32",
          "description": "Maximum length of the field value in characters. Applicable for text-type fields (text, textarea, richtextarea).",
          "minimum": 1,
          "maximum": 32000
        },
        "sequence_number": {
          "type": "integer",
          "format": "int32",
          "description": "Position/order of the field within the section (1-based). Lower numbers appear first.",
          "minimum": 1
        },
        "_delete": {
          "$ref": "#/$defs/DeleteObject",
          "description": "Delete configuration for removing the field. Set permanent to false to move to unused section (can be re-added later), true to permanently delete the field and its data."
        }
      },
      "additionalProperties": false
    },
    "Id": {
      "type": "string",
      "format": "int64",
      "pattern": "^[0-9]{1,19}$",
      "minLength": 1,
      "maxLength": 19,
      "description": "Unique identifier (64-bit integer represented as string)"
    },
    "LayoutUpdateObject": {
      "type": "object",
      "description": "Layout object containing the fields to update. At least one property must be provided. Maximum 5 sections and 5 fields (total across all sections) can be modified per request.",
      "minProperties": 1,
      "properties": {
        "name": {
          "type": "string",
          "description": "New name for the layout. Must be unique within the module.",
          "minLength": 1,
          "maxLength": 255
        },
        "show_business_card": {
          "type": "boolean",
          "description": "Enable or disable the business card display for this layout."
        },
        "profiles": {
          "type": "array",
          "description": "Array of profile objects to add or remove from the layout.",
          "items": {
            "$ref": "#/$defs/ProfileUpdateObject"
          },
          "minItems": 1,
          "maxItems": 50
        },
        "sections": {
          "type": "array",
          "description": "Array of section objects to create, update, or delete. Maximum 5 sections allowed per request. Total fields across all sections must not exceed 5.",
          "items": {
            "$ref": "#/$defs/SectionUpdateObject"
          },
          "minItems": 1,
          "maxItems": 5
        }
      },
      "additionalProperties": false
    },
    "ProfileUpdateObject": {
      "type": "object",
      "description": "Profile object for adding or removing profile permissions.",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/Id",
          "description": "Unique identifier of the profile."
        },
        "_delete": {
          "type": "boolean",
          "description": "Set to true to remove this profile's access to the layout."
        }
      },
      "additionalProperties": false
    },
    "SectionUpdateObject": {
      "type": "object",
      "description": "Section object for creating, updating, or deleting sections. For creating a new section, provide name, display_label, sequence_number, tab_traversal, and column_count. For updating an existing section, provide id along with properties to update. For deleting a section, provide id and _delete object.",
      "minProperties": 1,
      "properties": {
        "id": {
          "$ref": "#/$defs/Id",
          "description": "Unique identifier of the section. Required for updating or deleting existing sections. Omit when creating a new section."
        },
        "name": {
          "type": "string",
          "description": "Internal API name of the section. Required when creating a new section. Should be unique within the layout.",
          "minLength": 1,
          "maxLength": 255
        },
        "display_label": {
          "type": "string",
          "description": "Display label shown in the UI for the section. Required when creating a new section.",
          "minLength": 1,
          "maxLength": 255
        },
        "sequence_number": {
          "type": "integer",
          "format": "int32",
          "description": "Position/order of the section in the layout (1-based). Required when creating a new section. Lower numbers appear first.",
          "minimum": 1,
          "maximum": 100
        },
        "tab_traversal": {
          "type": "string",
          "description": "Tab traversal mode for the section. Defines how tab key navigation works within the section. 1 = column-wise, 2 = row-wise.",
          "enum": [
            "left_to_right",
            "top_to_bottom"
          ]
        },
        "column_count": {
          "type": "integer",
          "format": "int32",
          "description": "Number of columns in the section layout.",
          "minimum": 1,
          "maximum": 2
        },
        "fields": {
          "type": "array",
          "description": "Array of field objects to add, update, create, or remove from this section. Note: Total fields across all sections in the request must not exceed 5.",
          "items": {
            "$ref": "#/$defs/FieldUpdateObject"
          },
          "minItems": 1,
          "maxItems": 5
        },
        "_delete": {
          "$ref": "#/$defs/DeleteObject",
          "description": "Delete configuration for removing the section. When provided, the section identified by id will be deleted."
        }
      },
      "additionalProperties": true
    }
  }
}