{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usertold-ai/json-schema/usertold-ai-api-study-response-schema.json",
  "title": "ApiStudyResponse",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usertold-ai-openapi.json#/components/schemas/ApiStudyResponse",
  "type": "object",
  "properties": {
    "study": {
      "type": "object",
      "properties": {
        "ref": {
          "type": "string"
        },
        "handle": {
          "type": "string"
        },
        "project_ref": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "status": {
          "type": "string"
        },
        "goals_json": {
          "type": [
            "string",
            "null"
          ]
        },
        "script_json": {
          "type": [
            "string",
            "null"
          ]
        },
        "settings_json": {
          "type": [
            "string",
            "null"
          ]
        },
        "invitation": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "launcher": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "icon": {
                  "type": "string",
                  "enum": [
                    "feedback",
                    "mic",
                    "diagram",
                    "bug",
                    "research"
                  ]
                },
                "style": {
                  "type": "string",
                  "enum": [
                    "calm",
                    "lattice",
                    "beam",
                    "ticket"
                  ]
                },
                "shape": {
                  "type": "string",
                  "enum": [
                    "capsule",
                    "rounded",
                    "square"
                  ]
                }
              },
              "required": [
                "label",
                "icon"
              ],
              "additionalProperties": false
            },
            "panel": {
              "type": "object",
              "properties": {
                "eyebrow": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "headline": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 120
                },
                "body": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 600
                },
                "duration_minutes": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 240
                },
                "reward": {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "gift",
                        "product",
                        "community",
                        "access"
                      ]
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "eligibility": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 240
                    },
                    "delivery": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 240
                    }
                  },
                  "required": [
                    "kind",
                    "label"
                  ],
                  "additionalProperties": false
                },
                "cta": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                },
                "image": {
                  "type": "object",
                  "properties": {
                    "asset_id": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 160
                    },
                    "url": {
                      "type": "string",
                      "maxLength": 2000,
                      "format": "uri"
                    },
                    "alt": {
                      "type": "string",
                      "maxLength": 160
                    }
                  },
                  "required": [
                    "asset_id",
                    "url",
                    "alt"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "headline",
                "cta"
              ],
              "additionalProperties": false
            },
            "presentation_mode": {
              "type": "string",
              "enum": [
                "passive",
                "contextual",
                "direct_link"
              ]
            },
            "brand_color": {
              "type": "object",
              "properties": {
                "light": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                },
                "dark": {
                  "type": "string",
                  "pattern": "^#[0-9a-fA-F]{6}$"
                }
              },
              "required": [
                "light"
              ],
              "additionalProperties": false
            },
            "foreground_color": {
              "type": "string",
              "pattern": "^#[0-9a-fA-F]{6}$"
            },
            "placement": {
              "type": "object",
              "properties": {
                "desktop": {
                  "type": "string",
                  "enum": [
                    "bottom-left",
                    "bottom-right"
                  ]
                },
                "mobile": {
                  "type": "string",
                  "enum": [
                    "bottom-left",
                    "bottom-right"
                  ]
                }
              },
              "required": [
                "desktop",
                "mobile"
              ],
              "additionalProperties": false
            },
            "participant_interview_link": {
              "type": "boolean"
            }
          },
          "required": [
            "launcher",
            "presentation_mode",
            "brand_color",
            "placement"
          ],
          "additionalProperties": false
        },
        "invitation_state": {
          "type": "string",
          "enum": [
            "absent",
            "valid",
            "invalid"
          ]
        },
        "visibility": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "version": {
              "type": "number",
              "enum": [
                1
              ]
            },
            "enabled": {
              "type": "boolean"
            },
            "rules": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "effect": {
                    "type": "string",
                    "enum": [
                      "include",
                      "exclude"
                    ]
                  },
                  "match": {
                    "type": "string",
                    "enum": [
                      "exact",
                      "subtree"
                    ]
                  },
                  "pathname": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 2000,
                    "pattern": "^\\/(?!\\/)(?!.*\\/\\/)(?!.*[?#\\\\])(?=[\\x21-\\x7E]*$)(?!.*[\"<>^`{}])(?!(?:.*\\/)?(?:\\.|%2[eE]){1,2}(?:\\/|$))(?:$|.*[^/])$"
                  }
                },
                "required": [
                  "effect",
                  "match",
                  "pathname"
                ],
                "additionalProperties": false
              },
              "maxItems": 100,
              "default": []
            },
            "languages": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "maxItems": 20
            },
            "priority": {
              "type": "integer",
              "minimum": -1000000,
              "maximum": 1000000,
              "default": 0
            },
            "order": {
              "type": "integer",
              "minimum": 0,
              "maximum": 1000000,
              "default": 0
            }
          },
          "required": [
            "version",
            "enabled"
          ],
          "additionalProperties": false
        },
        "visibility_state": {
          "type": "string",
          "enum": [
            "absent",
            "valid",
            "invalid"
          ]
        },
        "recruitment_url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Shareable customer-page URL for a configured direct-link Invitation; null until an allowed origin is available."
        },
        "allowed_selectors": {
          "type": [
            "string",
            "null"
          ]
        },
        "allowed_origins": {
          "type": [
            "string",
            "null"
          ]
        },
        "intake_ref": {
          "type": [
            "string",
            "null"
          ]
        },
        "created_at": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "required": [
        "ref",
        "handle",
        "project_ref",
        "title",
        "description",
        "status",
        "goals_json",
        "script_json",
        "settings_json",
        "invitation",
        "invitation_state",
        "visibility",
        "visibility_state",
        "recruitment_url",
        "allowed_selectors",
        "allowed_origins",
        "intake_ref",
        "created_at",
        "updated_at"
      ]
    },
    "origin_guard_failure": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "session_id": {
          "type": "string"
        },
        "code": {
          "type": "string",
          "enum": [
            "origin_required",
            "origin_invalid",
            "origin_not_allowed"
          ]
        },
        "reason": {
          "type": "string"
        },
        "request_origin": {
          "type": [
            "string",
            "null"
          ]
        },
        "normalized_origin": {
          "type": [
            "string",
            "null"
          ]
        },
        "allowed_origins": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "policy_source": {
          "type": [
            "string",
            "null"
          ]
        },
        "occurred_at": {
          "type": "string"
        }
      },
      "required": [
        "session_id",
        "code",
        "reason",
        "request_origin",
        "normalized_origin",
        "allowed_origins",
        "policy_source",
        "occurred_at"
      ]
    },
    "intake_auto_created": {
      "type": "boolean"
    },
    "intake_ref": {
      "type": "string"
    }
  },
  "required": [
    "study"
  ]
}