{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/crevio-co/json-schema/crevio-co-form-request-schema.json",
  "title": "FormRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/crevio-co-openapi.json#/components/schemas/FormRequest",
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "redirect_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Full https:// URL people land on after they click the confirmation link, with `confirmation_required` on."
    },
    "delivery_type": {
      "type": "string",
      "enum": [
        "none",
        "file",
        "link",
        "experience"
      ],
      "description": "What everyone who submits gets by email, on every submission. `none` turns delivery off; `file` needs `delivery_file_id`, `link` needs `delivery_url`, `experience` needs `experience_id`."
    },
    "delivery_url": {
      "type": [
        "string",
        "null"
      ],
      "description": "Full https:// URL to send: a page, video or download elsewhere."
    },
    "experience_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Experience ID to grant access to; the email carries a sign-in link."
    },
    "delivery_subject": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subject of the delivery email. Defaults to \"Your freebie from <business> is here!\"."
    },
    "delivery_message": {
      "type": [
        "string",
        "null"
      ],
      "description": "Plain-text body of the delivery email; the download button is added below it."
    },
    "archived_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "tag_ids": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Tag IDs added to everyone who submits (never replacing their other tags). With `confirmation_required`, once they confirm."
    },
    "form_fields_attributes": {
      "type": "array",
      "description": "Nested-attributes payload for creating, updating, or destroying fields in one round-trip. Pass `id` to update an existing field; pass `_destroy: true` to remove one.",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": [
              "integer",
              "null"
            ],
            "description": "FormField id (omit when creating)"
          },
          "name": {
            "type": "string",
            "description": "User-facing label"
          },
          "field_type": {
            "type": "string",
            "enum": [
              "email",
              "text",
              "phone",
              "textarea",
              "radio",
              "select",
              "checkbox",
              "consent"
            ]
          },
          "required": {
            "type": "boolean"
          },
          "position": {
            "type": "integer",
            "description": "Zero-based ordinal"
          },
          "options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Required when field_type is radio/select/checkbox"
          },
          "_destroy": {
            "type": "boolean",
            "description": "Set true to remove this field"
          }
        },
        "required": [
          "name",
          "field_type"
        ]
      }
    },
    "settings": {
      "type": "object"
    },
    "confirmation_required": {
      "type": "boolean",
      "description": "Double opt-in: tags and the lead magnet wait until the person clicks the confirmation link."
    },
    "delivery_file_id": {
      "type": "string",
      "description": "File ID (`file_...`, from the Files API) to send as a download."
    }
  }
}