{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://docs.legalesign.com/schemas/send-input.schema.json",
  "title": "DocumentSendSettingsInput",
  "description": "Input for the send, sendBatchDocument, and addBulkDocument mutations. Defines the document, recipients, fields, and PDF options.",
  "type": "object",
  "required": ["groupId", "templateId", "title", "recipients"],
  "properties": {
    "groupId": {
      "type": "string",
      "description": "Base64-encoded group ID to send from. Decodes to `grp` followed by a UUID."
    },
    "templateId": {
      "type": "string",
      "description": "Base64-encoded template ID. Decodes to `tpl` followed by a UUID."
    },
    "title": {
      "type": "string",
      "maxLength": 1028,
      "description": "Document title shown to recipients."
    },
    "sequentialSigning": {
      "type": ["boolean", "null"],
      "description": "Send to recipients in order (true) or all at once (false). If omitted, uses the group default."
    },
    "allowCopying": {
      "type": ["boolean", "null"],
      "description": "Allow recipients to copy the final signed PDF. If omitted, uses the group default."
    },
    "allowPrinting": {
      "type": ["boolean", "null"],
      "description": "Allow recipients to print the final signed PDF. If omitted, uses the group default."
    },
    "suppressEmails": {
      "type": "boolean",
      "default": false,
      "description": "Suppress all notification emails for this document."
    },
    "tag": {
      "type": "string",
      "maxLength": 250,
      "description": "Tag for filtering or grouping documents. Can be empty string."
    },
    "pdfPassword": {
      "type": ["string", "null"],
      "maxLength": 150,
      "description": "Password-protect the final signed PDF. Empty string for no password. If omitted, uses the group default."
    },
    "retainPdfPassword": {
      "type": ["boolean", "null"],
      "description": "Keep the PDF password after document completion. If omitted, uses the group default."
    },
    "documentCCEmail": {
      "type": ["array", "null"],
      "maxItems": 10,
      "items": { "type": "string", "format": "email" },
      "description": "Additional email addresses to CC on the completed document. If omitted, uses the group default."
    },
    "redirect": {
      "type": ["string", "null"],
      "format": "uri",
      "description": "URL to redirect recipients to after signing. Empty string for no redirect. If omitted, uses the group default."
    },
    "recipients": {
      "type": "array",
      "maxItems": 199,
      "description": "List of recipients for the document.",
      "items": { "$ref": "#/$defs/RecipientInput" }
    },
    "senderFields": {
      "type": "array",
      "maxItems": 499,
      "description": "Pre-filled sender field values.",
      "items": { "$ref": "#/$defs/FieldInput" }
    },
    "participantFields": {
      "type": "array",
      "maxItems": 499,
      "description": "Pre-filled participant (signer) field values.",
      "items": { "$ref": "#/$defs/FieldInput" }
    }
  },
  "$defs": {
    "RecipientInput": {
      "type": "object",
      "description": "A recipient who will sign, approve, or witness the document.",
      "required": ["email", "order"],
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "maxLength": 75,
          "description": "Recipient's email address."
        },
         "order": {
          "type": "integer",
          "description": "Send order for sequential signing (0-indexed) and role selection (if roleId not used)."
        },
        "firstName": {
          "type": "string",
          "maxLength": 60,
          "description": "Recipient's first name."
        },
        "lastName": {
          "type": "string",
          "maxLength": 60,
          "description": "Recipient's last name."
        },
         "roleId": {
          "type": "string",
          "description": "Base64-encoded role ID from the template. Decodes to `rol` followed by a UUID. If not used, queries the role from your source template based on order."
        },
        "phoneNumber": {
          "type": "string",
          "maxLength": 120,
          "description": "Phone number in E.164 format (e.g. +447700900000). Can be empty string."
        },
        "experience": {
          "type": "string",
          "description": "Base64-encoded experience ID for the signing page. Decodes to `exp` followed by a UUID."
        },
        "scheduleId": {
          "type": "string",
          "description": "Base64-encoded preset reminder schedule ID. Decodes to `sch` followed by an integer. Empty string is permitted."
        },
        "schedule": {
          "type": "array",
          "description": "Inline custom reminder schedule. Use this or scheduleId, not both.",
          "items": { "$ref": "#/$defs/ScheduleItemInput" }
        },
        "message": {
          "type": "string",
          "maxLength": 8000,
          "description": "Email message body. Supports placeholders: {{signer_firstname}}, {{signer_lastname}}, {{sender_fullname}}, {{doc_name}}."
        },
        "attachments": {
          "type": "array",
          "items": { "type": "string" },
          "description": "Base64-encoded attachment IDs to include with the signing email. Each decodes to `att` followed by a UUID."
        },
        "expiryDate": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "When the signing invitation expires (ISO 8601, e.g. 2026-03-28T09:00:00.000Z). Null for no expiry."
        },
        "timeZone": {
          "type": "string",
          "description": "Recipient's time zone (IANA format, e.g. Europe/London)."
        },
        "ccFirstName": {
          "type": "string",
          "description": "CC contact first name."
        },
        "ccLastName": {
          "type": "string",
          "description": "CC contact last name."
        },
        "ccEmail": {
          "type": "string",
          "format": "email",
          "description": "CC contact email address."
        },
        "ccMessage": {
          "type": "string",
          "description": "CC message text."
        },
        "ccIncludeLink": {
          "type": "boolean",
          "description": "Include the signing link in the CC email."
        }
      }
    },
    "FieldInput": {
      "type": "object",
      "description": "Pre-fill a field value on the document.",
      "required": ["id"],
      "properties": {
        "id": {
          "type": "string",
          "description": "Base64-encoded template element ID. Decodes to `ele` followed by a UUID."
        },
        "value": {
          "type": "string",
          "description": "Value to pre-fill. Empty string to clear the template default. If omitted, the template default is used."
        },
        "roleId": {
          "type": "string",
          "description": "Base64-encoded role ID. Decodes to `rol` followed by a UUID. For sender (admin) fields only — reassigns the field to the specified recipient."
        }
      }
    },
    "ScheduleItemInput": {
      "type": "object",
      "description": "A reminder schedule step.",
      "required": ["daysAfter", "frequency", "when", "timeOfDay", "subject", "message", "skipWeekend"],
      "properties": {
        "daysAfter": {
          "type": "integer",
          "description": "Days after send to trigger."
        },
        "frequency": {
          "type": "integer",
          "description": "Follow-up frequency in days (0 = no repeat)."
        },
        "when": {
          "type": "integer",
          "enum": [1, 2, 3],
          "description": "Trigger condition: 1=not visited, 2=not completed, 3=always."
        },
        "timeOfDay": {
          "type": "string",
          "description": "Send time (HH:MM:SS)."
        },
        "subject": {
          "type": "string",
          "maxLength": 500,
          "description": "Reminder email subject."
        },
        "message": {
          "type": "string",
          "maxLength": 500,
          "description": "Reminder email message."
        },
        "skipWeekend": {
          "type": "boolean",
          "description": "Skip weekends."
        }
      }
    }
  }
}
