{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/userintuition-ai/json-schema/userintuition-ai-public-study-create-schema.json",
  "title": "PublicStudyCreate",
  "description": "Create a study. Unknown fields, including incentive settings, are rejected.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/userintuition-ai-openapi.json#/components/schemas/PublicStudyCreate",
  "properties": {
    "name": {
      "type": "string",
      "maxLength": 40,
      "minLength": 1,
      "title": "Name"
    },
    "study_type": {
      "type": "string",
      "enum": [
        "in-depth-interview",
        "concept-test",
        "prototype-test"
      ],
      "title": "Study Type",
      "description": "Study-type template slug",
      "default": "in-depth-interview"
    },
    "recruiting_method": {
      "type": "string",
      "enum": [
        "panel",
        "byop",
        "synthetic_respondents"
      ],
      "title": "Recruiting Method"
    },
    "interview_format": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "chat",
            "video",
            "voice"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Interview Format",
      "description": "chat, video, or voice. Defaults to chat and only accepts chat when recruiting_method is synthetic_respondents."
    },
    "voice": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "male",
            "female"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Voice",
      "description": "Interviewer voice: male (Elliot) or female (Clara)"
    },
    "language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "enum": [
        "auto",
        "af",
        "am",
        "ar",
        "as",
        "az",
        "bg",
        "bn",
        "bs",
        "ca",
        "cs",
        "cy",
        "da",
        "de",
        "el",
        "en",
        "es",
        "et",
        "eu",
        "fa",
        "fi",
        "fil",
        "fr",
        "ga",
        "gl",
        "gu",
        "he",
        "hi",
        "hr",
        "hu",
        "hy",
        "id",
        "is",
        "it",
        "iu",
        "ja",
        "jv",
        "ka",
        "kk",
        "km",
        "kn",
        "ko",
        "lo",
        "lt",
        "lv",
        "mk",
        "ml",
        "mn",
        "mr",
        "ms",
        "mt",
        "my",
        "nb",
        "ne",
        "nl",
        "or",
        "pa",
        "pl",
        "ps",
        "pt",
        "ro",
        "ru",
        "si",
        "sk",
        "sl",
        "so",
        "sq",
        "sr",
        "su",
        "sv",
        "sw",
        "ta",
        "te",
        "th",
        "tr",
        "uk",
        "ur",
        "uz",
        "vi",
        "wuu",
        "yue",
        "zh",
        "zu"
      ],
      "title": "Language",
      "description": "Interview language: an ISO 639-1 code, or 'auto' to auto-detect. Must be one of the supported options."
    },
    "study_plan": {
      "anyOf": [
        {
          "$ref": "#/$defs/PublicStudyPlanSeed"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional plan sections. Customize Plan keeps the supplied text and fills in missing sections before saving."
    },
    "expected_duration_seconds": {
      "anyOf": [
        {
          "type": "integer",
          "maximum": 1800.0,
          "minimum": 300.0
        },
        {
          "type": "null"
        }
      ],
      "title": "Expected Duration Seconds",
      "description": "Maximum planned interview duration in seconds, including all sections, transitions, and likely follow-up probes. Estimate this from the completed study plan; it is not a guaranteed participant completion time."
    },
    "screener_questions": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/PublicScreenerQuestionInput"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Screener Questions",
      "description": "Screener questions and answer options are stored in English. Non-English input is translated before saving. Participants see the interview-language copy, including the required mic or webcam question."
    },
    "targeting_attributes": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/PublicTargetingAttribute"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Targeting Attributes",
      "description": "Target the panel by demographic qualifications (panel studies)."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "recruiting_method"
  ],
  "$defs": {
    "NumericRange": {
      "properties": {
        "min": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Min",
          "description": "Inclusive lower bound"
        },
        "max": {
          "anyOf": [
            {
              "type": "integer",
              "minimum": 0.0
            },
            {
              "type": "null"
            }
          ],
          "title": "Max",
          "description": "Inclusive upper bound"
        }
      },
      "type": "object",
      "title": "NumericRange",
      "description": "Optional inclusive bounds constraining a numeric `text_input` answer."
    },
    "PublicScreenerOptionInput": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text"
        },
        "disqualify": {
          "type": "boolean",
          "title": "Disqualify",
          "default": false
        },
        "selection_rule": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "must_select",
                "may_select",
                "reject"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Selection Rule",
          "description": "multi_select only. must_select requires the participant to select this option; may_select makes it optional; reject disqualifies the participant when selected."
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "text"
      ],
      "title": "PublicScreenerOptionInput",
      "description": "Inbound screener option. ``id`` is auto-generated if omitted."
    },
    "PublicScreenerQuestionInput": {
      "properties": {
        "text": {
          "type": "string",
          "title": "Text"
        },
        "type": {
          "type": "string",
          "enum": [
            "single_select",
            "multi_select",
            "text_input"
          ],
          "title": "Type",
          "default": "single_select"
        },
        "options": {
          "items": {
            "$ref": "#/$defs/PublicScreenerOptionInput"
          },
          "type": "array",
          "title": "Options"
        },
        "order": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Order"
        },
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id"
        },
        "input_mode": {
          "anyOf": [
            {
              "type": "string",
              "enum": [
                "integers_only",
                "unrestricted"
              ]
            },
            {
              "type": "null"
            }
          ],
          "title": "Input Mode",
          "description": "text_input only. Which characters the field accepts."
        },
        "numeric_ranges": {
          "anyOf": [
            {
              "items": {
                "$ref": "#/$defs/NumericRange"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Numeric Ranges",
          "description": "text_input + integers_only only. Optional minimum and/or maximum shown to the participant; empty/absent accepts any integer."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "text"
      ],
      "title": "PublicScreenerQuestionInput",
      "description": "Inbound screener question. ``id``/``order`` are auto-generated if omitted."
    },
    "PublicStudyPlanSeed": {
      "properties": {
        "objectives": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Objectives",
          "description": "What the study is trying to learn and the decision it informs."
        },
        "conversation_flow": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Conversation Flow",
          "description": "How the interview should flow — topics/clusters with example prompts."
        },
        "background": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Background",
          "description": "Context about the company/product/market."
        },
        "learning_goals": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Learning Goals",
          "description": "Answerable questions as ### Learning goal N: headings, each followed by **Evidence needed:** requirements."
        },
        "study_specific_rules": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Study Specific Rules",
          "description": "Operational guardrails and neutrality notes."
        },
        "study_improvements": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Study Improvements",
          "description": "Accepted additions to guide future interviews."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "PublicStudyPlanSeed",
      "description": "Sections supplied to Customize Plan when creating a study."
    },
    "PublicTargetingAttribute": {
      "properties": {
        "qualification_id": {
          "type": "integer",
          "title": "Qualification Id",
          "description": "Qualification id (from GET /targeting-attributes)"
        },
        "allowed_options": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Allowed Options",
          "description": "option_ids to allow"
        },
        "disallowed_options": {
          "items": {
            "type": "integer"
          },
          "type": "array",
          "title": "Disallowed Options",
          "description": "option_ids to disqualify"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "qualification_id"
      ],
      "title": "PublicTargetingAttribute",
      "description": "Target the panel by a qualification's answer options. Option-id rules:\n- both lists empty → allow all options;\n- only allowed → disqualify any option not listed;\n- only disallowed → allow any option not listed (can't disallow them all);\n- both → allowed are kept, disallowed are disqualified, and together they\n  must cover every option_id of the qualification.\nLook up qualification_id / option_id via GET /targeting-attributes."
    }
  }
}