{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/foxform-app/json-schema/foxform-app-publish-form-response-schema.json",
  "title": "PublishFormResponse",
  "x-generated": "2026-11-08",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/foxform-app-openapi.json#/components/schemas/PublishFormResponse",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "allOf": [
        {
          "$ref": "#/$defs/Form"
        }
      ],
      "type": "object"
    },
    "message": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "description": "PAID_FIELDS_REQUIRED on 402."
    },
    "paidFields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PaidField"
      }
    },
    "prohibitedFields": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "questionId": {
            "type": "string"
          },
          "questionTitle": {
            "type": "string"
          },
          "reason": {
            "type": "string"
          },
          "category": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "AlertItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "description": "theme|error|info|success|warning or hex."
        },
        "severity": {
          "type": "string",
          "enum": [
            "warning",
            "info",
            "success",
            "error",
            "custom"
          ]
        },
        "iconKey": {
          "type": "string"
        },
        "highlight": {
          "type": "boolean"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    },
    "ArgumentItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "imageUrl": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "text": {
          "type": "string"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    },
    "ButtonAction": {
      "type": "object",
      "properties": {
        "type": {
          "$ref": "#/$defs/NavigationTarget"
        },
        "targetScreenId": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "openNewTab": {
          "type": "boolean"
        }
      }
    },
    "ConditionGroup": {
      "type": "object",
      "description": "Conditions AND-joined; groups OR-joined.",
      "properties": {
        "id": {
          "type": "string"
        },
        "conditions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConditionV2"
          }
        },
        "then": {
          "type": "object",
          "properties": {
            "type": {
              "$ref": "#/$defs/NavigationTarget"
            },
            "targetScreenId": {
              "type": "string"
            }
          }
        }
      }
    },
    "ConditionV2": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "left": {
          "type": "string",
          "description": "Literal, {{variable}} or calc(...)."
        },
        "operator": {
          "type": "string",
          "enum": [
            "equal_to",
            "not_equal_to",
            "greater_than",
            "greater_or_equal_than",
            "less_than",
            "less_or_equal_than",
            "contains"
          ]
        },
        "right": {
          "type": "string"
        }
      }
    },
    "ConditionalLogicV2": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConditionGroup"
          }
        }
      }
    },
    "DisplayRule": {
      "type": "object",
      "properties": {
        "enabled": {
          "type": "boolean"
        },
        "groups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ConditionGroup"
          }
        },
        "showAfterSeconds": {
          "type": "number"
        }
      }
    },
    "Form": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "user_id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "slug": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "draft",
            "published",
            "closed"
          ]
        },
        "theme": {
          "type": "string",
          "description": "Form theme. New forms default to amber (copper-to-amber gradient, the FoxForm default); base is the neutral graphite option.",
          "default": "amber",
          "enum": [
            "amber",
            "base",
            "midnight",
            "ocean",
            "sunset",
            "forest",
            "lavender",
            "minimal"
          ]
        },
        "questions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/QuestionConfig"
          }
        },
        "thank_you_message": {
          "type": "string"
        },
        "webhook_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "show_progress_bar": {
          "type": "boolean"
        },
        "show_navigation_arrows": {
          "type": "boolean"
        },
        "email_notifications": {
          "type": "boolean"
        },
        "hide_branding": {
          "type": "boolean",
          "description": "Remove 'Powered by FoxForm' (Pro/Starter only)."
        },
        "published_at": {
          "type": "string",
          "format": "date-time"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "NavigationTarget": {
      "type": "string",
      "enum": [
        "next_screen",
        "previous_screen",
        "specific_screen",
        "end_form"
      ]
    },
    "PaidField": {
      "type": "object",
      "properties": {
        "feature": {
          "type": "string",
          "enum": [
            "file_upload",
            "picture_choice",
            "video_upload",
            "testimonials_photo"
          ]
        },
        "questionIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "PriceCard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "highlightText": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "tag": {
          "type": "string"
        },
        "prefix": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "suffix": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "priceType": {
          "type": "string",
          "enum": [
            "illustrative",
            "redirect",
            "checkout"
          ]
        },
        "buttonText": {
          "type": "string"
        },
        "url": {
          "type": "string"
        },
        "openNewTab": {
          "type": "boolean"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    },
    "QuestionConfig": {
      "type": "object",
      "required": [
        "id",
        "type",
        "title",
        "required"
      ],
      "description": "A single screen/field. Covers input, selection, scale, flow (welcome/loading/result/end) and content (alert/testimonials/video/timer/arguments/price/progress_bar) types, plus the funnel layer (points, values, {{variables}}, calc, conditional navigation/display, rich text).",
      "properties": {
        "id": {
          "type": "string"
        },
        "type": {
          "$ref": "#/$defs/QuestionType"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "required": {
          "type": "boolean"
        },
        "buttonText": {
          "type": "string"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Legacy plain options (dropdown/checkboxes/multiple_choice). Migrated into `choices`."
        },
        "choices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/QuestionOption"
          },
          "description": "Canonical option objects (funnel: points/value)."
        },
        "minValue": {
          "type": "number"
        },
        "maxValue": {
          "type": "number"
        },
        "placeholder": {
          "type": "string"
        },
        "allowedFileTypes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "maxFileSize": {
          "type": "number",
          "description": "MB"
        },
        "maxFiles": {
          "type": "integer"
        },
        "allowMultipleFiles": {
          "type": "boolean"
        },
        "defaultCountry": {
          "type": "string",
          "description": "ISO 2-letter (phone)."
        },
        "randomize": {
          "type": "boolean"
        },
        "alphabetical": {
          "type": "boolean"
        },
        "allowOther": {
          "type": "boolean"
        },
        "otherLabel": {
          "type": "string"
        },
        "otherPlaceholder": {
          "type": "string"
        },
        "style": {
          "$ref": "#/$defs/QuestionStyle"
        },
        "logic": {
          "$ref": "#/$defs/QuestionLogic"
        },
        "shape": {
          "type": "string",
          "description": "Rating icon shape (star, heart, smiley, thumbs_up, crown, ...)."
        },
        "showNumbers": {
          "type": "boolean"
        },
        "label0": {
          "type": "string"
        },
        "label5": {
          "type": "string"
        },
        "label10": {
          "type": "string"
        },
        "colorScheme": {
          "type": "string",
          "enum": [
            "gradient",
            "monochrome"
          ],
          "description": "NPS."
        },
        "npsLeftLabel": {
          "type": "string"
        },
        "npsRightLabel": {
          "type": "string"
        },
        "step": {
          "type": "number"
        },
        "initialValue": {
          "type": "number"
        },
        "prefix": {
          "type": "string"
        },
        "suffix": {
          "type": "string"
        },
        "showCurrentValue": {
          "type": "boolean"
        },
        "dateFormat": {
          "type": "string",
          "enum": [
            "MDY",
            "DMY",
            "YMD"
          ]
        },
        "dateSeparator": {
          "type": "string",
          "enum": [
            "/",
            "-",
            "."
          ]
        },
        "itemsPerRow": {
          "type": "integer",
          "enum": [
            2,
            3
          ]
        },
        "aspectRatio": {
          "type": "string",
          "enum": [
            "1:1",
            "4:3",
            "3:4",
            "16:9"
          ]
        },
        "images": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "points": {
                "type": "number"
              },
              "value": {
                "type": "string"
              }
            }
          }
        },
        "multipleSelection": {
          "type": "boolean"
        },
        "showLabels": {
          "type": "boolean"
        },
        "numberModel": {
          "type": "string",
          "enum": [
            "plain",
            "currency",
            "percentage",
            "decimal",
            "height",
            "weight"
          ]
        },
        "currency": {
          "type": "string",
          "enum": [
            "BRL",
            "USD",
            "EUR"
          ]
        },
        "decimals": {
          "type": "integer"
        },
        "heightUnit": {
          "type": "string",
          "enum": [
            "cm",
            "in"
          ]
        },
        "weightUnit": {
          "type": "string",
          "enum": [
            "kg",
            "lb"
          ]
        },
        "videoSource": {
          "type": "string",
          "enum": [
            "upload",
            "url",
            "embed"
          ]
        },
        "videoUrl": {
          "type": "string"
        },
        "videoEmbed": {
          "type": "string"
        },
        "videoAspectRatio": {
          "type": "string",
          "enum": [
            "16:9",
            "1:1",
            "4:5",
            "original"
          ]
        },
        "videoObjectFit": {
          "type": "string",
          "enum": [
            "cover",
            "contain"
          ]
        },
        "caption": {
          "type": "string"
        },
        "autoplay": {
          "type": "boolean"
        },
        "loop": {
          "type": "boolean"
        },
        "requirePlayback": {
          "type": "boolean"
        },
        "countdownType": {
          "type": "string",
          "enum": [
            "until_date",
            "fixed_period"
          ]
        },
        "periodDays": {
          "type": "integer"
        },
        "periodHours": {
          "type": "integer"
        },
        "periodMinutes": {
          "type": "integer"
        },
        "periodSeconds": {
          "type": "integer"
        },
        "targetDate": {
          "type": "string"
        },
        "onZero": {
          "type": "string",
          "enum": [
            "show_message",
            "hide",
            "redirect",
            "auto_advance",
            "submit_form"
          ]
        },
        "redirectUrl": {
          "type": "string"
        },
        "expireMessage": {
          "type": "string"
        },
        "resultCards": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ResultCard"
          }
        },
        "alerts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/AlertItem"
          }
        },
        "argumentItems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ArgumentItem"
          }
        },
        "testimonialItems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/TestimonialItem"
          }
        },
        "testimonialsLayout": {
          "type": "string",
          "enum": [
            "carousel",
            "single",
            "grid"
          ]
        },
        "showRatings": {
          "type": "boolean"
        },
        "autoRotate": {
          "type": "boolean"
        },
        "layout": {
          "type": "string",
          "enum": [
            "grid",
            "list"
          ]
        },
        "progressLabel": {
          "type": "string"
        },
        "progressValueType": {
          "type": "string",
          "enum": [
            "fixed",
            "variable"
          ]
        },
        "progressValue": {
          "type": "number"
        },
        "progressExpression": {
          "type": "string"
        },
        "showPercentage": {
          "type": "boolean"
        },
        "priceModel": {
          "type": "string",
          "enum": [
            "single",
            "selection",
            "table"
          ]
        },
        "priceCards": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PriceCard"
          }
        },
        "priceRows": {
          "type": "array",
          "items": {
            "type": "object"
          }
        },
        "variableName": {
          "type": "string",
          "description": "Token used in {{...}} interpolation (defaults to id)."
        },
        "files": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "size": {
                "type": "number"
              },
              "mime": {
                "type": "string"
              },
              "gdriveFileId": {
                "type": "string"
              }
            }
          }
        },
        "mediaUrl": {
          "type": "string"
        },
        "mediaType": {
          "type": "string",
          "enum": [
            "image",
            "video",
            "iframe"
          ]
        },
        "buttonEnabled": {
          "type": "boolean",
          "description": "End screen only. false hides the button, leaving just the title and description (all formats, including chatbot). Missing or true = button shown."
        },
        "buttonLink": {
          "type": "string"
        },
        "buttonOpenNewTab": {
          "type": "boolean"
        },
        "autoRedirect": {
          "type": "boolean",
          "description": "End screen only. true sends respondents to autoRedirectUrl automatically after they submit (the response is recorded first). Shows a 'Redirecting in N s' countdown with a 'Go now' link. All formats."
        },
        "autoRedirectUrl": {
          "type": "string",
          "format": "uri",
          "description": "End screen only. Absolute http/https URL. Query params from the form link (utm_*, gclid, ...) are appended and {{param}} tokens are filled from them, like buttonLink."
        },
        "autoRedirectDelay": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10,
          "default": 3,
          "description": "End screen only. Seconds to wait before redirecting."
        },
        "socialEnabled": {
          "type": "boolean"
        },
        "socialLinks": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "platform": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "iconUrl": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "QuestionLogic": {
      "type": "object",
      "properties": {
        "autoAdvance": {
          "type": "object",
          "properties": {
            "enabled": {
              "type": "boolean"
            },
            "delaySeconds": {
              "type": "number"
            }
          }
        },
        "navigationBehavior": {
          "type": "object",
          "properties": {
            "onButtonClick": {
              "$ref": "#/$defs/NavigationTarget"
            },
            "onAutoAdvance": {
              "$ref": "#/$defs/NavigationTarget"
            },
            "targetScreenId": {
              "type": "string"
            }
          }
        },
        "conditionalNavigationV2": {
          "$ref": "#/$defs/ConditionalLogicV2"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    },
    "QuestionOption": {
      "type": "object",
      "required": [
        "id",
        "label"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "icon": {
          "type": "string"
        },
        "imageUrl": {
          "type": "string"
        },
        "points": {
          "type": "number",
          "description": "Adds to {{score}} when selected."
        },
        "value": {
          "type": "string",
          "description": "Exposed via {{variable}} for later steps."
        }
      }
    },
    "QuestionStyle": {
      "type": "object",
      "properties": {
        "theme": {
          "type": "string"
        },
        "fontFamily": {
          "type": "string"
        },
        "textColor": {
          "type": "string"
        },
        "accentColor": {
          "type": "string"
        },
        "buttonBackgroundColor": {
          "type": "string"
        },
        "buttonTextColor": {
          "type": "string"
        },
        "verticalAlignment": {
          "type": "string",
          "enum": [
            "center",
            "left",
            "right"
          ]
        },
        "backgroundType": {
          "type": "string",
          "enum": [
            "theme",
            "image",
            "color"
          ]
        },
        "backgroundImage": {
          "type": "string"
        },
        "backgroundColor": {
          "type": "string"
        }
      }
    },
    "QuestionType": {
      "type": "string",
      "enum": [
        "welcome",
        "loading",
        "result",
        "end",
        "short_text",
        "long_text",
        "dropdown",
        "checkboxes",
        "multiple_choice",
        "email",
        "phone",
        "number",
        "date",
        "rating",
        "opinion_scale",
        "nps",
        "yes_no",
        "file_upload",
        "picture_choice",
        "url",
        "slider",
        "alert",
        "testimonials",
        "media",
        "timer",
        "arguments",
        "price",
        "progress_bar"
      ]
    },
    "ResultCard": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "iconUrl": {
          "type": "string"
        },
        "imageUrl": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "buttonText": {
          "type": "string"
        },
        "buttonAction": {
          "$ref": "#/$defs/ButtonAction"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    },
    "TestimonialItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "photoUrl": {
          "type": "string",
          "description": "Photo makes the field Pro-only."
        },
        "name": {
          "type": "string"
        },
        "handle": {
          "type": "string"
        },
        "stars": {
          "type": "integer",
          "minimum": 1,
          "maximum": 5
        },
        "text": {
          "type": "string"
        },
        "display": {
          "$ref": "#/$defs/DisplayRule"
        }
      }
    }
  }
}