{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nanostudiopro-com/json-schema/nanostudiopro-com-storyboard-schema.json",
  "title": "Storyboard",
  "description": "A storyboard as an agent plans from it. `doc` is the document the mutations address (camelCase inside, like the operations); everything around it is snake_case.",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nanostudiopro-com-openapi.json#/components/schemas/Storyboard",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "project_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "The storyboard's page, where the owner watches."
    },
    "rev": {
      "type": "integer"
    },
    "can_undo": {
      "type": "boolean"
    },
    "can_redo": {
      "type": "boolean"
    },
    "read_only": {
      "type": "boolean",
      "description": "Saved by a newer version of the app: `doc` is null and nothing can change."
    },
    "doc": {
      "type": [
        "object",
        "null"
      ],
      "description": "idea, cast, places, panels (keyframes), segments, decisions, cues, startPanelId, agentSpend; and when set: theme (the title music), sounds (the film's sound list), ambience (place id -> its sound), endScreens (ending keyframe id -> its end screen), mix (the sound layers' levels set by hand), score (the music on the timeline: `cues`, each {id, soundId, fromPanelId, toPanelId?, path?, offsetS?, fadeInS?, fadeOutS?, level?, scored?}); each take's `effects` (sound effects at a second of its clip: {id, soundId, atS, level?, pitch?, rise?})."
    },
    "poster": {
      "allOf": [
        {
          "$ref": "#/$defs/StoryboardImage"
        }
      ],
      "nullable": true,
      "description": "The poster in use (one of `posters`)."
    },
    "posters": {
      "type": "array",
      "description": "Every poster made for the film, newest first (at most 12). `setPoster { generationId }` picks one (a new id joins the list), `removePoster { generationId }` takes one out (the picture stays in the library; the one in use falls back to the newest left).",
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/StoryboardImage"
          },
          {
            "type": "object",
            "properties": {
              "in_use": {
                "type": "boolean"
              }
            }
          }
        ]
      }
    },
    "keyframes": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "beat": {
            "type": "string"
          },
          "entity_ids": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Pass these to `POST /v1/generations` as `entity_ids` for this keyframe's picture."
          },
          "entity_ids_left_out": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Over the cap of 12, by priority."
          },
          "image": {
            "allOf": [
              {
                "$ref": "#/$defs/StoryboardImage"
              }
            ],
            "nullable": true
          }
        }
      }
    },
    "issues": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "panel",
                  "segment",
                  "decision",
                  "cue"
                ]
              },
              "id": {
                "type": "string"
              }
            }
          },
          "level": {
            "type": "string",
            "enum": [
              "error",
              "advice"
            ]
          },
          "message": {
            "type": "string"
          },
          "rule": {
            "type": "string",
            "description": "The rule that fired."
          },
          "key": {
            "type": "string",
            "description": "Stable across edits. An advice that is intended is marked so with the mutation {op: \"ackIssue\", key} and stops showing ({op: \"unackIssue\", key} brings it back). Errors cannot be marked."
          }
        }
      }
    },
    "acknowledged": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "The issue keys marked as intended (doc.acknowledged)."
    },
    "ai_feedback": {
      "type": "object",
      "description": "What the owner said of each AI continuity finding, by its key: {verdict: intended|wrong|correct, note?, at, version (of the check), text (what it said), takeIds}. Set with the mutation {op: \"setAiFeedback\", key, verdict, note?} (note up to 300 characters; verdict null clears it). \"intended\" also marks it as intended; \"wrong\" hides it and a re-run on the same takes does not raise it again; the note is told to the next check of that clip or cut.",
      "additionalProperties": {
        "type": "object"
      }
    },
    "readiness": {
      "type": [
        "object",
        "null"
      ],
      "description": "Ready for video? Every issue told where it is in the film, errors first. Null when read_only.",
      "properties": {
        "ready": {
          "type": "boolean",
          "description": "No error left and every keyframe has its picture."
        },
        "errors": {
          "type": "integer"
        },
        "advice": {
          "type": "integer"
        },
        "acknowledged": {
          "type": "integer",
          "description": "Advice marked as intended: left out of rows."
        },
        "ai_wrong": {
          "type": "integer",
          "description": "AI findings marked \"AI is wrong\" (setAiFeedback): left out of rows."
        },
        "rows": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "where": {
                "type": "string",
                "description": "For example \"Moment 3\" or \"Moments 2 to 3\"."
              },
              "key": {
                "type": "string",
                "description": "The issue's stable key (see issues)."
              },
              "level": {
                "type": "string",
                "enum": [
                  "error",
                  "advice"
                ]
              },
              "message": {
                "type": "string"
              },
              "target": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "panel",
                      "segment",
                      "decision",
                      "cue"
                    ]
                  },
                  "id": {
                    "type": "string"
                  }
                }
              },
              "feedback": {
                "type": "object",
                "description": "An AI finding the owner marked: {verdict: intended|wrong|correct, note?}."
              }
            }
          }
        }
      }
    },
    "paths": {
      "type": "array",
      "description": "Every route from the start to an ending, decisions branching it.",
      "items": {
        "type": "object",
        "properties": {
          "panel_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "segment_ids": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "choices": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "decision id -> option id taken on this path."
          },
          "length_s": {
            "type": "number",
            "description": "The plan's length: every segment's seconds and the end hold."
          },
          "played_length_s": {
            "type": "number",
            "description": "As the player plays it: trims, speed ramps and dissolves (which overlap) counted, with the clips finished so far."
          },
          "beats_s": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "description": "The music's beats on the played clock, while a cue whose track has a beat grid plays (`POST /v1/storyboards/{id}/sounds/{soundId}/beat` or `setSoundBeat`). Land a cut on one by trimming the take's `outS`."
          },
          "timeline": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "panel_id": {
                  "type": "string"
                },
                "segment_id": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "start_s": {
                  "type": "number"
                },
                "hold_s": {
                  "type": "number"
                },
                "played_start_s": {
                  "type": "number"
                },
                "played_s": {
                  "type": "number"
                },
                "enter": {
                  "$ref": "#/$defs/StoryboardTransition"
                },
                "after_choice": {
                  "allOf": [
                    {
                      "$ref": "#/$defs/StoryboardTransition"
                    }
                  ],
                  "description": "At a decision's keyframe: how the chosen option arrives out of the wait."
                },
                "sound_tail_s": {
                  "type": "number",
                  "description": "Seconds of the previous clip's sound carried under this moment."
                },
                "sound_lead_s": {
                  "type": "number",
                  "description": "Seconds this moment's sound starts before its picture."
                }
              }
            }
          }
        }
      }
    },
    "title_screen": {
      "type": [
        "object",
        "null"
      ],
      "description": "What a shared film shows before Play: its title (the storyboard's name), poster and title music (`updateTitleScreen`).",
      "properties": {
        "title": {
          "type": "string"
        },
        "poster": {
          "allOf": [
            {
              "$ref": "#/$defs/StoryboardImage"
            }
          ],
          "nullable": true
        },
        "music": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "name": {
              "type": [
                "string",
                "null"
              ]
            },
            "sound_id": {
              "type": [
                "string",
                "null"
              ],
              "description": "Null for music chosen before the sound list."
            },
            "volume": {
              "type": [
                "number",
                "null"
              ]
            },
            "loop": {
              "type": "boolean"
            }
          }
        },
        "choice_sound": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "chime",
            "bell",
            "pluck",
            "whoosh",
            "tick",
            "none",
            null
          ],
          "description": "What a viewer hears on picking an option; null: the default, chime."
        }
      }
    },
    "end_screens": {
      "type": "array",
      "description": "One per keyframe a path ends on (`updateEndScreen`); null fields fall back to the film's title and the title music.",
      "items": {
        "type": "object",
        "properties": {
          "panel_id": {
            "type": "string"
          },
          "title": {
            "type": [
              "string",
              "null"
            ]
          },
          "image": {
            "allOf": [
              {
                "$ref": "#/$defs/StoryboardImage"
              }
            ],
            "nullable": true
          },
          "music": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "sound_id": {
                "type": "string"
              },
              "volume": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "loop": {
                "type": "boolean"
              }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "StoryboardImage": {
      "type": "object",
      "properties": {
        "generation_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "asset_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri",
          "description": "Signed; expires. Null when the picture is gone."
        },
        "missing": {
          "type": "boolean"
        }
      }
    },
    "StoryboardTransition": {
      "type": "object",
      "description": "How a moment arrives: computed from what the storyboard knows (same place: dissolve; another place, time of day or weather: dip; a decision's keyframe: cut), its length from the shorter clip, unless set by hand (`manual`).",
      "properties": {
        "kind": {
          "type": "string",
          "description": "cut, memory, or a transition from the library (`GET /v1/storyboards/options`): dissolve, dip, whip, glitch..."
        },
        "s": {
          "type": "number",
          "description": "Seconds; 0 for a cut. A dip goes through its colour (black unless set), half out, half in; every other kind overlaps the two pictures; a memory (set by hand only) overlaps them while the picture going out disintegrates."
        },
        "params": {
          "type": "object",
          "additionalProperties": true,
          "description": "The transition's params as set by hand (absent: its defaults)."
        },
        "manual": {
          "type": "boolean"
        },
        "why": {
          "type": "string"
        }
      }
    }
  }
}