{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/dottedsign-com/json-schema/dottedsign-com-template-request-update-schema.json",
  "title": "TemplateRequestUpdate",
  "description": "Template update.",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dottedsign-com-templates-api-openapi.yml#/components/schemas/TemplateRequestUpdate",
  "type": "object",
  "required": [
    "template_id"
  ],
  "properties": {
    "file_mission_id": {
      "type": "integer",
      "description": "File mission ID returned from the [Create a file mission](ref:createfilemission) or [Renew a file mission](ref:renewfilemission) API."
    },
    "template_id": {
      "type": "integer",
      "description": "Template ID."
    },
    "file_name": {
      "type": "string",
      "description": "File name.\n**File name should match the pattern `^(?!.*[\\\"*:<>\\?\\/\\\\|~#%&{}])[^.].*$`.**\n",
      "maxLength": 255
    },
    "has_order": {
      "type": "boolean",
      "description": "Signers should sign sequentially or not.",
      "default": true
    },
    "watermark_id": {
      "type": "integer",
      "description": "Watermark ID.\nCurrently, this only supports the use of `watermark_id` that have been used in a template.\n"
    },
    "metadata": {
      "type": "object",
      "description": "Metadata. **Maximum 10 key-value pairs, where each key length must be less than or equal to 40 characters and each value length must be less than or equal to 100 characters.**"
    },
    "stages": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DummyStageRequest"
      }
    },
    "template_setting": {
      "$ref": "#/$defs/TemplateSettingRequest"
    }
  },
  "$defs": {
    "DummyStageRequest": {
      "type": "object",
      "required": [
        "role"
      ],
      "properties": {
        "role": {
          "type": "string",
          "description": "Role."
        },
        "email": {
          "type": "string",
          "description": "Email.",
          "maxLength": 250
        },
        "stage_type": {
          "type": "string",
          "description": "Stage type (Recipient type).",
          "enum": [
            "sign",
            "edit"
          ]
        },
        "attachment_settings": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/StageRequestAttachmentSetting"
          }
        },
        "custom_message_setting": {
          "$ref": "#/$defs/StageRequestCustomMessageSetting"
        },
        "field_settings": {
          "type": "array",
          "description": "Field settings. Required if `stage_type` is `sign`.",
          "items": {
            "$ref": "#/$defs/FieldSettingRequest"
          }
        },
        "field_setting_groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/FieldSettingGroupRequest"
          }
        },
        "review_stages": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ReviewStageRequest"
          }
        },
        "stage_setting": {
          "$ref": "#/$defs/StageSettingRequest"
        },
        "verify_methods": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/VerifyMethodRequest"
          }
        }
      },
      "description": "Dummy stage request body."
    },
    "FieldSettingGroupRequest": {
      "type": "object",
      "description": "Field setting group request body.",
      "required": [
        "field_group_type",
        "field_group_object_id"
      ],
      "properties": {
        "field_group_type": {
          "type": "string",
          "description": "Field group type.",
          "enum": [
            "checkbox",
            "radio"
          ]
        },
        "field_group_object_id": {
          "type": "string",
          "description": "Field group object ID. Only used for mapping field settings to field group."
        },
        "options": {
          "type": "object",
          "description": "Field group options.",
          "properties": {
            "force": {
              "type": "boolean",
              "description": "Force to fill or not.",
              "default": false
            },
            "read_only": {
              "type": "boolean",
              "description": "Read only or not.",
              "default": false
            }
          }
        }
      }
    },
    "FieldSettingRequest": {
      "type": "object",
      "required": [
        "field_type",
        "page",
        "coord"
      ],
      "properties": {
        "field_type": {
          "type": "string",
          "description": "Field type.",
          "enum": [
            "signature",
            "textfield",
            "datefield",
            "checkbox",
            "radio",
            "image",
            "link"
          ]
        },
        "field_group_object_id": {
          "type": "string",
          "description": "Field group object ID. *Required if field type is `checkbox` or `radio`.*\nFor `radio` fields, there must be a minimum of two `field_setting`s sharing the same `field_group_object_id`.\nFor both `checkbox` and `radio` types, the `field_group_object_id` can encompass up to 50 `field_setting`s.\n"
        },
        "page": {
          "type": "integer",
          "description": "Page number. Starts from 0."
        },
        "coord": {
          "type": "array",
          "description": "Field coordinates, consisting of 4 numbers. These numbers represent the left-x, bottom-y, right-x, and top-y coordinates, respectively.",
          "items": {
            "type": "number"
          },
          "minItems": 4,
          "maxItems": 4
        },
        "options": {
          "$ref": "#/$defs/FieldSettingRequestOptions"
        },
        "search_key": {
          "type": "string",
          "description": "Search key.\n*Only supports letters, numbers, and underscores, with a maximum of 16 characters.*\n*Available field_types include `textfield`, `datefield`, and `link`.*\n",
          "maxLength": 16,
          "pattern": "^\\w{0,16}$"
        }
      },
      "description": "Field setting request body."
    },
    "FieldSettingRequestOptions": {
      "type": "object",
      "properties": {
        "default": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "boolean"
            },
            {
              "type": "integer"
            }
          ],
          "nullable": true,
          "description": "Default value.\n*Default `\"\"` for `textfield`; `null` for `signature`, `datefield` and `link`; `false` for `checkbox` and `radio`.*\n*Available field_types include `signature`, `textfield`, `datefield`, `checkbox`, `radio`, and `link`.*\n"
        },
        "force": {
          "type": "boolean",
          "description": "Force to fill or not.\n*Default `true` for `signature`, `textfield, `datefield, `image`, and `link`.*\n*Available field_types include `signature`, `textfield`, `datefield`, `link`, and `image`.*\n"
        },
        "default_type": {
          "type": [
            "string",
            "null"
          ],
          "description": "Default value type for `signature`.\n*Available field_types include `signature`.*\n",
          "enum": [
            "seal",
            "signature"
          ]
        },
        "read_only": {
          "type": "boolean",
          "description": "Read only or not.\n*Available field_types include `textfield`, `datefield`, and `link`.*\n"
        },
        "is_multi_line": {
          "type": "boolean",
          "description": "Multi-line or not.\n*Available field_types include `textfield`.*\n"
        },
        "placeholder": {
          "type": "string",
          "description": "Placeholder.\n*Available field_types include `signature`, `textfield`, `datefield`, `link`, and `image`.*\n"
        },
        "font_size": {
          "type": "integer",
          "description": "Font size.\n*Available field_types include `textfield`, `datefield`, and `link`.*\n",
          "minimum": 8,
          "maximum": 34
        },
        "font_size_fixed": {
          "type": "boolean",
          "description": "Font size fixed or not.\n*Available field_types include `textfield`, `datefield`, and `link`.*\n"
        },
        "alignment": {
          "type": "string",
          "description": "Alignment.\n*Available field_types include `textfield`, `datefield`, and `link`. Default `left`*\n",
          "enum": [
            "left",
            "center",
            "right"
          ]
        },
        "alignment_fixed": {
          "type": "boolean",
          "description": "Alignment fixed or not.\n*Available field_types include `textfield`, `datefield`, and `link`.*\n"
        },
        "length": {
          "type": "integer",
          "description": "Length.\n*Available field_types include `textfield`.*\n",
          "minimum": 1,
          "maximum": 500
        },
        "validation": {
          "type": "string",
          "description": "Validation type.\n*Available field_types include `textfield`.*\n",
          "enum": [
            "email",
            "numbers",
            "letters",
            "regex"
          ]
        },
        "validation_regex": {
          "type": "string",
          "description": "Validation regex. *Required if validation is `regex`.*\n*Available field_types include `textfield`.*\n"
        },
        "date_format": {
          "type": "string",
          "description": "Date format.\n*Available field_types include `datefield`.*\n",
          "enum": [
            "yyyy-mm-dd",
            "yyyy/mm/dd",
            "dd/mm/yyyy",
            "mm-dd-yyyy"
          ]
        },
        "date_setting": {
          "type": "string",
          "description": "Date setting.\n*Available field_types include `datefield`.*\n",
          "enum": [
            "current_only",
            "future_enable",
            "past_enable",
            "no_limit"
          ]
        },
        "zone": {
          "type": "integer",
          "description": "Time zone.\n*Available field_types include `datefield`.*\n",
          "minimum": -12,
          "maximum": 14
        }
      },
      "description": "Field setting request body - options."
    },
    "ReviewStageRequest": {
      "type": "object",
      "description": "Review stage request body.",
      "required": [
        "base_stage_sequence"
      ],
      "properties": {
        "base_stage_sequence": {
          "type": "integer",
          "description": "Base stage sequence. If reviewer is owner, then `0`; otherwise signer's stage sequence (start from `1`)."
        }
      }
    },
    "SourceSettingRequestCcInfo": {
      "type": "object",
      "description": "Source setting request body - cc info.",
      "required": [
        "email",
        "name"
      ],
      "properties": {
        "email": {
          "type": "string",
          "description": "CC email.",
          "maxLength": 250
        },
        "name": {
          "type": "string",
          "description": "CC name."
        },
        "viewable_source_files": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Files that can be viewed by the CC recipient. Using file_object_ids returned when creating the file mission."
        }
      }
    },
    "SourceSettingRequestReferenceSetting": {
      "type": "object",
      "description": "Source setting request body - reference setting.",
      "required": [
        "file_name",
        "reference_id",
        "reference_type"
      ],
      "properties": {
        "file_name": {
          "type": "string",
          "description": "Reference name."
        },
        "reference_id": {
          "type": "string",
          "description": "Reference ID."
        },
        "reference_type": {
          "type": "string",
          "description": "Reference file type."
        },
        "force": {
          "type": "boolean",
          "description": "Force signers to consent to the file or not."
        },
        "viewable_in_processing": {
          "type": "boolean",
          "description": "Signers can view the file or not before the task is completed."
        }
      }
    },
    "StageRequestAttachmentSetting": {
      "type": "object",
      "description": "Stage request body - attachment setting.",
      "required": [
        "attachment_id",
        "file_name"
      ],
      "properties": {
        "attachment_id": {
          "type": "string",
          "description": "Attachment ID (will be replaced after task is created). Should be unique in the task."
        },
        "file_name": {
          "type": "string",
          "description": "Attachment name."
        },
        "force": {
          "type": "boolean",
          "description": "Signer must upload attachment or not.",
          "default": false
        },
        "viewable_in_processing": {
          "type": "boolean",
          "description": "Attachment is viewable by other signers or not, will be effective along with `viewable_in_processing` in `StageSettingRequest`. The signer who is also the owner will be `true`.",
          "default": false
        }
      }
    },
    "StageRequestCustomMessageSetting": {
      "type": "object",
      "properties": {
        "viewable_in_processing": {
          "type": "boolean",
          "description": "Custom message is viewable by other signers or not when task is processing."
        },
        "viewable_in_completed": {
          "type": "boolean",
          "description": "Custom message is viewable by other signers or not when task is completed."
        }
      },
      "description": "Sign stage request body - custom message setting."
    },
    "StageSettingRequest": {
      "type": "object",
      "description": "Stage setting request body.",
      "properties": {
        "forward_enable": {
          "type": "boolean",
          "description": "Available to change signer.\n*For signer who is also the task owner, this option must be and defaults to `true`; otherwise, it defaults to `false`*\n"
        },
        "decline_enable": {
          "type": "boolean",
          "description": "Available to decline the task.\n*For signer who is also the task owner, this option must be and defaults to `false`; otherwise, it defaults to `true`*\n"
        },
        "viewable_in_processing": {
          "type": "boolean",
          "description": "Available to view attachments when task is processing."
        },
        "viewable_in_completed": {
          "type": "boolean",
          "description": "Available to view attachments when task is completed."
        },
        "viewable_source_files": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Files that can be viewed by the recipient. Using file_object_ids returned when creating the file mission."
        },
        "viewable_references": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Reference files that can be viewed by the signer. Using reference_ids in `task_setting.reference_settings`."
        },
        "informable": {
          "type": "boolean",
          "description": "Inform the signer through email or not when task is updated.",
          "default": false
        },
        "reviewed_skip_confirm": {
          "type": "boolean",
          "description": "Do not need to confirm when signer's stage is reviewed.",
          "default": true
        }
      }
    },
    "TemplateSettingRequest": {
      "type": "object",
      "properties": {
        "deadline": {
          "type": "integer",
          "description": "Deadline in timestamp in seconds.",
          "maximum": 9999999999
        },
        "forget_remind": {
          "type": "boolean",
          "description": "Remind the signer or not when task is waiting for signing."
        },
        "expire_remind": {
          "type": "boolean",
          "description": "Remind the signer or not when task is going to be expired."
        },
        "remind_days_before_expire": {
          "type": "integer",
          "description": "Days before expire to remind the signer.",
          "enum": [
            1,
            2,
            3
          ]
        },
        "link_expire_days": {
          "type": "integer",
          "description": "Days before the signing link in notification emails expires (Quick Signing). Defaults to the owner's preference (2 days). *For the quick create API, if not provided, the task inherits the template's setting; for the template APIs, an omitted value means the template follows its owner's preference. For the update APIs, the current value is kept when not provided.*",
          "minimum": 2,
          "maximum": 365
        },
        "forget_remind_days": {
          "type": "integer",
          "description": "Days after the signing request to send the first reminder to the signer; a second reminder is sent at 3× this value. Only effective when `forget_remind` is `true`. Defaults to the owner's preference (2 days). Accepts 2–10, so the second reminder is sent no later than day 30. *For the quick create API, if not provided, the task inherits the template's setting; for the template APIs, an omitted value means the template follows its owner's preference. For the update APIs, the current value is kept when not provided.*",
          "minimum": 2,
          "maximum": 10
        },
        "cc_infos": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SourceSettingRequestCcInfo"
          }
        },
        "message": {
          "type": "string",
          "description": "Message to the signer when task is processing.",
          "maxLength": 1500
        },
        "completed_message": {
          "type": "string",
          "description": "Message to the signer when task is completed.",
          "maxLength": 1500
        },
        "reference_settings": {
          "type": "array",
          "description": "Reference information viewable to signers when task is processing.\n",
          "items": {
            "$ref": "#/$defs/SourceSettingRequestReferenceSetting"
          }
        },
        "completed_reference_settings": {
          "type": "array",
          "description": "Reference information viewable to signers when task is completed.\nThis key will be deprecated in the future; please include all references in the 'reference_settings' key instead.\n",
          "deprecated": true,
          "items": {
            "$ref": "#/$defs/SourceSettingRequestReferenceSetting"
          }
        },
        "receiver_lang": {
          "type": "string",
          "description": "Language displayed for the signer, only effective if signer has not set his preferred language.",
          "default": "en",
          "enum": [
            "de",
            "en",
            "es",
            "it",
            "ja",
            "fa",
            "ko",
            "zh-CN",
            "zh-TW"
          ]
        },
        "owner_informable": {
          "type": "boolean",
          "description": "Inform the owner through email or not when task is updated.",
          "default": false
        }
      },
      "description": "Template setting request body."
    },
    "VerifyMethodRequest": {
      "type": "object",
      "description": "Verify method request body.",
      "required": [
        "verify_type"
      ],
      "properties": {
        "verify_type": {
          "type": "string",
          "description": "Verify type.\n*Available verify types depend on the user's pricing plan or group's settings.*\n",
          "enum": [
            "email",
            "sms",
            "twca_mid"
          ]
        },
        "verify_source": {
          "type": "string",
          "description": "Verify source (area code + number).\n*Required if `verify_type` is `sms`. Used as the signer's mobile number if `verify_type` is `twca_mid`.*\n*For `twca_mid`, only one of `verify_source`/`options.national_id_number` is required to create the verify method, but both are needed for verification to actually succeed.*\n"
        },
        "occasion": {
          "type": "string",
          "description": "Verify occasion.",
          "default": "sign",
          "enum": [
            "sign",
            "read"
          ]
        },
        "options": {
          "type": "object",
          "description": "Verify method options. *Available if `verify_type` is `twca_mid`.*",
          "properties": {
            "national_id_number": {
              "type": "string",
              "description": "National ID number.\n*Required if `verify_type` is `twca_mid` and `verify_source` is not given.*\n*Only one of `national_id_number`/`verify_source` is required to create the verify method — but both are needed for verification to actually succeed. See `verify_source`'s description for details.*\n"
            }
          }
        }
      }
    }
  }
}