{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/userintuition-ai/json-schema/userintuition-ai-public-interview-schema.json",
  "title": "PublicInterview",
  "description": "Interview detail with bounded, paged speech segments.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/userintuition-ai-openapi.json#/components/schemas/PublicInterview",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id"
    },
    "study_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Study Id",
      "description": "The study this interview belongs to"
    },
    "participant": {
      "anyOf": [
        {
          "$ref": "#/$defs/PublicInterviewParticipant"
        },
        {
          "type": "null"
        }
      ],
      "description": "null for synthetic, anonymous panel, external-panel, or open-link interviews"
    },
    "participant_source": {
      "type": "string",
      "enum": [
        "byop",
        "panel",
        "external_panel",
        "link",
        "synthetic",
        "unknown"
      ],
      "title": "Participant Source",
      "description": "Recruitment source; synthetic, anonymous panel and open-link respondents have no public person identity"
    },
    "status": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Status"
    },
    "quality": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Quality",
      "description": "Quality rating: Excellent, Good, Fair, or Poor"
    },
    "ended_because": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "completed",
            "participant_left",
            "time_limit",
            "technical_error",
            "screened_out"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Ended Because",
      "description": "Why the interview ended; null if the stored reason cannot be classified"
    },
    "started_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Started At",
      "description": "Date and time the interview took place"
    },
    "ended_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ended At",
      "description": "Date and time the interview ended"
    },
    "interview_format": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "chat",
            "video",
            "voice"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Interview Format",
      "description": "Stored interview mode; null when the historical mode is unknown"
    },
    "language": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Language",
      "description": "Current configured study language, not a detected transcript language; historical interviews may have used an earlier configuration"
    },
    "duration_seconds": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Duration Seconds",
      "description": "Interview length in seconds (ended_at - started_at)"
    },
    "pii_redacted": {
      "type": "boolean",
      "title": "Pii Redacted",
      "description": "True when common structured identifiers were masked and direct identity/media links omitted; this does not guarantee all PII was detected",
      "default": false
    },
    "messages": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/PublicTranscriptSegment"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Messages",
      "description": "Spoken segments (up to message_limit and about 20 KB). Each has id, role, message, text_offset, and start_s/end_s when stored timing exists."
    },
    "total_message_segments": {
      "type": "integer",
      "title": "Total Message Segments",
      "default": 0
    },
    "next_message_offset": {
      "anyOf": [
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "title": "Next Message Offset"
    },
    "audio_recording_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Audio Recording Url"
    },
    "video_recording_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Video Recording Url"
    },
    "screener_responses": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/PublicScreenerResponse"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Screener Responses",
      "description": "The participant's screener answers for this interview."
    }
  },
  "type": "object",
  "required": [
    "id",
    "participant_source"
  ],
  "$defs": {
    "PublicInterviewParticipant": {
      "properties": {
        "id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Id",
          "description": "BYOP invitation ID, not a deduplicated person ID"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Email"
        }
      },
      "type": "object",
      "title": "PublicInterviewParticipant"
    },
    "PublicScreenerResponse": {
      "properties": {
        "question": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Question",
          "description": "The screener question text"
        },
        "type": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Type",
          "description": "single_select, multi_select, or text_input"
        },
        "answer": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Answer",
          "description": "The participant's answer (option text(s) or free text)"
        }
      },
      "type": "object",
      "title": "PublicScreenerResponse"
    },
    "PublicTranscriptSegment": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Original transcript turn ID; split segments retain the same ID"
        },
        "role": {
          "type": "string",
          "enum": [
            "participant",
            "moderator"
          ],
          "title": "Role"
        },
        "message": {
          "type": "string",
          "title": "Message"
        },
        "text_offset": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Text Offset",
          "description": "Character offset within the original turn"
        },
        "start_s": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Start S",
          "description": "Stored seconds from interview start"
        },
        "end_s": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "End S",
          "description": "Stored seconds from interview start"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "role",
        "message"
      ],
      "title": "PublicTranscriptSegment"
    }
  }
}