{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/100hires-com/json-schema/100hires-com-nurture-campaign-create-request-schema.json",
  "title": "NurtureCampaignCreateRequest",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/100hires-com-nurture-campaigns-api-openapi.yml#/components/schemas/NurtureCampaignCreateRequest",
  "type": "object",
  "required": [
    "title",
    "steps"
  ],
  "properties": {
    "company_id": {
      "type": "integer",
      "description": "Target company ID (optional if API key is scoped to one company)"
    },
    "title": {
      "type": "string",
      "description": "Campaign name"
    },
    "workflow_id": {
      "type": "integer",
      "description": "Workflow ID to bind the campaign to"
    },
    "stage_id": {
      "type": "integer",
      "description": "Stage ID that triggers the campaign"
    },
    "delay_time": {
      "type": "integer",
      "description": "Delay before the first step, in seconds (0–86400). Takes precedence over relative_days + relative_time when both are sent."
    },
    "relative_days": {
      "type": "integer",
      "description": "Days after the trigger for the first step. Used together with relative_time."
    },
    "relative_time": {
      "type": "integer",
      "description": "Time of day for the first step, in seconds from midnight (0–86400). Used together with relative_days."
    },
    "timezone": {
      "type": "string",
      "description": "IANA timezone, e.g. \"America/New_York\""
    },
    "send_to_all": {
      "type": "boolean",
      "default": false,
      "description": "Send to all candidates or only new ones"
    },
    "response_move_to_stage_id": {
      "type": "integer",
      "description": "Stage to move candidate to when they reply"
    },
    "steps": {
      "type": "array",
      "description": "Campaign steps (at least one required)",
      "items": {
        "$ref": "#/$defs/NurtureCampaignStepInput"
      }
    }
  },
  "$defs": {
    "NurtureCampaignStepAssignTagInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "tag_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "assign_tag"
              ]
            },
            "tag_id": {
              "type": "integer",
              "description": "Tag ID to assign"
            }
          }
        }
      ]
    },
    "NurtureCampaignStepAssignTaskInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "task_template_id",
            "assignees"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "assign_task"
              ]
            },
            "task_template_id": {
              "type": "integer",
              "description": "Task template ID"
            },
            "assignees": {
              "type": "array",
              "items": {
                "type": "integer"
              },
              "description": "Assignee user IDs"
            },
            "due_in_interval": {
              "type": "string",
              "description": "Due date interval, e.g. \"P3D\""
            },
            "priority": {
              "type": "integer",
              "description": "Task priority"
            }
          }
        }
      ]
    },
    "NurtureCampaignStepEmailInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "sender",
            "template_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "email"
              ]
            },
            "sender": {
              "type": "object",
              "required": [
                "type",
                "id"
              ],
              "properties": {
                "type": {
                  "type": "string",
                  "description": "Sender type (e.g. \"account\", \"user\")"
                },
                "id": {
                  "type": "integer",
                  "description": "Sender ID"
                }
              }
            },
            "template_id": {
              "type": "integer",
              "description": "Email template ID"
            },
            "is_new_thread": {
              "type": "boolean",
              "description": "Send as new email thread"
            },
            "schedule_id": {
              "type": "integer",
              "description": "Sending schedule ID"
            },
            "is_send_by_carousel": {
              "type": "boolean",
              "description": "Send by carousel rotation"
            }
          }
        }
      ]
    },
    "NurtureCampaignStepInput": {
      "description": "Step input. The required fields depend on the step `type`.\n",
      "oneOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepEmailInput"
        },
        {
          "$ref": "#/$defs/NurtureCampaignStepSmsInput"
        },
        {
          "$ref": "#/$defs/NurtureCampaignStepVoicemailInput"
        },
        {
          "$ref": "#/$defs/NurtureCampaignStepMoveToNextStageInput"
        },
        {
          "$ref": "#/$defs/NurtureCampaignStepAssignTagInput"
        },
        {
          "$ref": "#/$defs/NurtureCampaignStepAssignTaskInput"
        }
      ]
    },
    "NurtureCampaignStepInputBase": {
      "type": "object",
      "required": [
        "type",
        "delay_days",
        "send_condition"
      ],
      "properties": {
        "id": {
          "type": "integer",
          "description": "Step ID (required for updating existing steps)"
        },
        "type": {
          "type": "string",
          "description": "Step type discriminator."
        },
        "delay_days": {
          "type": "integer",
          "minimum": 0,
          "description": "Days to wait before executing this step"
        },
        "send_condition": {
          "type": "string",
          "description": "Condition for sending this step.",
          "enum": [
            "if_no_reply",
            "if_no_reply_but_opened"
          ]
        },
        "is_deleted": {
          "type": "boolean",
          "description": "Set to true to remove this step during update"
        }
      }
    },
    "NurtureCampaignStepMoveToNextStageInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "stage_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "move_to_next_stage"
              ]
            },
            "stage_id": {
              "type": "integer",
              "description": "Target pipeline stage ID"
            }
          }
        }
      ]
    },
    "NurtureCampaignStepSmsInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "sender_user_id",
            "template_id"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "sms"
              ]
            },
            "sender_user_id": {
              "type": "integer",
              "description": "Sender user ID"
            },
            "template_id": {
              "type": "integer",
              "description": "SMS template ID"
            },
            "schedule_id": {
              "type": "integer",
              "description": "Sending schedule ID"
            },
            "is_send_by_carousel": {
              "type": "boolean",
              "description": "Send by carousel rotation"
            }
          }
        }
      ]
    },
    "NurtureCampaignStepVoicemailInput": {
      "allOf": [
        {
          "$ref": "#/$defs/NurtureCampaignStepInputBase"
        },
        {
          "type": "object",
          "required": [
            "attachment_uuid"
          ],
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "voicemail"
              ]
            },
            "attachment_uuid": {
              "type": "string",
              "format": "uuid",
              "description": "Voicemail audio file UUID. Reuse the `attachment_uuid` from an existing voicemail step, or upload a new audio file through `POST /attachments` with category `voicemail` and use the returned `uuid`."
            },
            "schedule_id": {
              "type": "integer",
              "description": "Sending schedule ID"
            }
          }
        }
      ]
    }
  }
}