{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/primateintelligence-ai/json-schema/primateintelligence-ai-create-analysis-request-schema.json",
  "title": "CreateAnalysisRequest",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/primateintelligence-ai-openapi.json#/components/schemas/CreateAnalysisRequest",
  "type": "object",
  "properties": {
    "video_id": {
      "type": "string",
      "pattern": "^video_[0-9A-HJKMNP-TV-Z]{26}$",
      "description": "Video resource id (prefixed ULID). Immutable."
    },
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 2000,
      "description": "Free text — compiled server-side. Exactly one of prompt/query."
    },
    "query": {
      "type": "object",
      "additionalProperties": {},
      "description": "Structured CompiledQuery JSON (schema at /v1/schemas/compiled-query.json)."
    },
    "model": {
      "type": "string",
      "description": "Defaults to latest (currently Darwin-preview-1.3B, status preview); deprecated aliases (e.g. darwin-1.3) are accepted case-insensitively; response always echoes the canonical id."
    },
    "options": {
      "type": "object",
      "properties": {
        "narrative": {
          "type": "boolean",
          "default": false
        }
      },
      "description": "narrative: true — generate a narrative (timestamped event sentences) for the analysis. Populates the narrative object on the completed analysis; generation runs asynchronously after completion (poll the GET — status generating → ready|failed). Included in the analysis price."
    },
    "metadata": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "maxLength": 500
      },
      "description": "Free-form key/value metadata. ≤16 keys, key ≤40 chars [a-zA-Z0-9_.-], value ≤500 chars."
    },
    "webhook": {
      "type": "object",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri"
        },
        "events": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "url",
        "events"
      ],
      "description": "Per-request webhook override (delivery ships P7). Write-only — never echoed."
    },
    "validate_only": {
      "type": "boolean",
      "description": "Dry run (PRI-480). Compiles the prompt, reports whether the query is assessable, and estimates duration/cost — WITHOUT creating an analysis, touching the GPU, or burning credits. Returns an AnalysisPreview (object: \"analysis_preview\") with 200, not an Analysis. Use it to check a prompt before paying for it."
    }
  },
  "required": [
    "video_id"
  ]
}