{
  "openapi": "3.1.0",
  "info": {
    "title": "Woodcock Vision Management API",
    "version": "0.3.1-dev",
    "description": "Management uses HttpOnly cookie sessions and CSRF tokens. Optional authenticated RTMP/RTMPS publishing produces public multi-quality HLS. CDN, pull, DASH and MP4 outputs remain pending. See STREAMING.md for enablement, bounds and OBS acceptance checks. Publishing accepts a case-sensitive public stream name or existing private key; optional feed passwords apply to both. Names without a feed password permit publishing by anyone knowing the name. Renaming invalidates the old name; rotating a private key does not revoke name publishing. The Studio dashboard includes a seven-layout player generator. /player.html is public and embeddable; management/API routes retain frame isolation. See PLAYER_GENERATOR.md for settings, exports and browser limitations."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:8080",
      "description": "Development default; replace with configured public_url"
    }
  ],
  "security": [
    {
      "sessionCookie": []
    }
  ],
  "paths": {
    "/api/v1/session": {
      "post": {
        "summary": "Sign in and issue an HttpOnly session cookie",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "csrf_token": "<csrf_token>"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "username",
                  "password"
                ],
                "properties": {
                  "username": {
                    "type": "string",
                    "maxLength": 64
                  },
                  "password": {
                    "type": "string",
                    "maxLength": 256
                  }
                }
              },
              "example": {
                "username": "admin",
                "password": "<administrator-password>"
              }
            }
          }
        },
        "description": "Login is rate-limited by direct TCP peer. The session cookie is HttpOnly and SameSite=Strict. Retrieve csrf_token from login or GET session; send X-CSRF-Token on every authenticated mutation. Logout revokes the session. API tokens are planned, not available."
      },
      "get": {
        "summary": "Check session and obtain CSRF token",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Session"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "authenticated": true,
                    "csrf_token": "<csrf_token>"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "description": "Login is rate-limited by direct TCP peer. The session cookie is HttpOnly and SameSite=Strict. Retrieve csrf_token from login or GET session; send X-CSRF-Token on every authenticated mutation. Logout revokes the session. API tokens are planned, not available."
      },
      "delete": {
        "summary": "Invalidate the current session",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "logged_out": true
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "description": "Login is rate-limited by direct TCP peer. The session cookie is HttpOnly and SameSite=Strict. Retrieve csrf_token from login or GET session; send X-CSRF-Token on every authenticated mutation. Logout revokes the session. API tokens are planned, not available."
      }
    },
    "/api/v1/streams": {
      "get": {
        "summary": "List configurations, bounded by max_streams",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Stream"
                      }
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": [
                    {
                      "id": "<stream_id>",
                      "name": "ft_stream1",
                      "description": "Main programme",
                      "enabled": false,
                      "profile": {
                        "video_codec": "h264",
                        "audio_codec": "aac",
                        "audio_bitrate_kbps": 128,
                        "preset": "veryfast",
                        "segment_seconds": 4,
                        "renditions": [
                          {
                            "name": "720p",
                            "width": 1280,
                            "height": 720,
                            "bitrate_kbps": 2500,
                            "fps": 30
                          },
                          {
                            "name": "480p",
                            "width": 854,
                            "height": 480,
                            "bitrate_kbps": 1000,
                            "fps": 30
                          }
                        ]
                      },
                      "has_publish_password": false,
                      "status": "disabled",
                      "created_at": "2026-10-25T06:00:00Z",
                      "updated_at": "2026-10-25T06:00:00Z"
                    }
                  ],
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "description": "Lists bounded pre-provisioned streams without publishing credentials, with current media status and a public playback URL when live. New streams default to disabled."
      },
      "post": {
        "summary": "Create configuration and show publishing key once",
        "responses": {
          "201": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/CreateResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "stream": {
                      "id": "<stream_id>",
                      "name": "ft_stream1",
                      "description": "Main programme",
                      "enabled": false,
                      "profile": {
                        "video_codec": "h264",
                        "audio_codec": "aac",
                        "audio_bitrate_kbps": 128,
                        "preset": "veryfast",
                        "segment_seconds": 4,
                        "renditions": [
                          {
                            "name": "720p",
                            "width": 1280,
                            "height": 720,
                            "bitrate_kbps": 2500,
                            "fps": 30
                          },
                          {
                            "name": "480p",
                            "width": 854,
                            "height": 480,
                            "bitrate_kbps": 1000,
                            "fps": 30
                          }
                        ]
                      },
                      "has_publish_password": false,
                      "status": "disabled",
                      "created_at": "2026-10-25T06:00:00Z",
                      "updated_at": "2026-10-25T06:00:00Z"
                    },
                    "publishing_key": "<shown-once-publishing-key>",
                    "key_notice": "optional private key shown once; public stream name also works under /live"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {
                    "type": "string",
                    "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
                  },
                  "description": {
                    "type": "string",
                    "description": "At most 1024 UTF-8 bytes"
                  },
                  "enabled": {
                    "type": "boolean",
                    "default": false
                  },
                  "profile": {
                    "$ref": "#/components/schemas/Profile",
                    "description": "Defaults to the server profile when omitted at creation. A supplied PATCH profile replaces the entire profile."
                  }
                },
                "required": [
                  "name"
                ]
              },
              "example": {
                "name": "ft_stream1",
                "description": "Main programme",
                "enabled": false
              }
            }
          }
        },
        "description": "Only pre-provisioned streams will accept publishers when ingest is implemented. Public names are separate from secret publishing keys. Listing has no pagination or query filters in this release; max_streams bounds the result. New streams default to disabled and receive the default profile when omitted."
      }
    },
    "/api/v1/streams/{id}": {
      "get": {
        "summary": "Read a configuration",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Stream"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "<stream_id>",
                    "name": "ft_stream1",
                    "description": "Main programme",
                    "enabled": false,
                    "profile": {
                      "video_codec": "h264",
                      "audio_codec": "aac",
                      "audio_bitrate_kbps": 128,
                      "preset": "veryfast",
                      "segment_seconds": 4,
                      "renditions": [
                        {
                          "name": "720p",
                          "width": 1280,
                          "height": 720,
                          "bitrate_kbps": 2500,
                          "fps": 30
                        },
                        {
                          "name": "480p",
                          "width": 854,
                          "height": 480,
                          "bitrate_kbps": 1000,
                          "fps": 30
                        }
                      ]
                    },
                    "has_publish_password": false,
                    "status": "disabled",
                    "created_at": "2026-10-25T06:00:00Z",
                    "updated_at": "2026-10-25T06:00:00Z"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Use the opaque ID returned by creation, not the public name. PATCH preserves omitted top-level fields; a supplied profile must contain the complete validated profile. Unknown JSON fields are rejected. Runtime status and playback_url reflect current media availability. Saving a configuration disconnects active publishing."
      },
      "patch": {
        "summary": "Update supplied fields; profile replaces the complete profile",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/Stream"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "id": "<stream_id>",
                    "name": "ft_stream1",
                    "description": "Updated programme",
                    "enabled": true,
                    "profile": {
                      "video_codec": "h264",
                      "audio_codec": "aac",
                      "audio_bitrate_kbps": 128,
                      "preset": "veryfast",
                      "segment_seconds": 4,
                      "renditions": [
                        {
                          "name": "720p",
                          "width": 1280,
                          "height": 720,
                          "bitrate_kbps": 2500,
                          "fps": 30
                        },
                        {
                          "name": "480p",
                          "width": 854,
                          "height": 480,
                          "bitrate_kbps": 1000,
                          "fps": 30
                        }
                      ]
                    },
                    "has_publish_password": false,
                    "status": "media_disabled",
                    "created_at": "2026-10-25T06:00:00Z",
                    "updated_at": "2026-10-25T06:00:00Z"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StreamInput"
              },
              "example": {
                "description": "Updated programme",
                "enabled": true
              }
            }
          }
        },
        "description": "Use the opaque ID returned by creation, not the public name. PATCH preserves omitted top-level fields; a supplied profile must contain the complete validated profile. Unknown JSON fields are rejected. Runtime status and playback_url reflect current media availability. Saving a configuration disconnects active publishing. Saving disconnects any active publisher; reconnect applies the new settings."
      },
      "delete": {
        "summary": "Delete a configuration",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "deleted": true
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "description": "Use the opaque ID returned by creation, not the public name. PATCH preserves omitted top-level fields; a supplied profile must contain the complete validated profile. Unknown JSON fields are rejected. Runtime status and playback_url reflect current media availability. Saving a configuration disconnects active publishing. Active publishers are disconnected when the change succeeds."
      }
    },
    "/api/v1/streams/{id}/rotate-key": {
      "post": {
        "summary": "Invalidate the previous publishing key",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "$ref": "#/components/schemas/KeyResult"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "publishing_key": "<new-shown-once-publishing-key>",
                    "key_notice": "shown once; previous key invalidated"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "description": "Previous publishing credentials are invalidated immediately in storage. The replacement is shown once. Save it securely; GET/list never returns it. Active media-session behavior will be defined with RTMP ingest. Active publishers are disconnected when the change succeeds."
      }
    },
    "/api/v1/streams/{id}/publish-password": {
      "put": {
        "summary": "Store an additional feed password hash",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "has_publish_password": true
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "password"
                ],
                "properties": {
                  "password": {
                    "type": "string",
                    "minLength": 15,
                    "description": "At most 256 UTF-8 bytes"
                  }
                }
              },
              "example": {
                "password": "<15-or-more-character-password>"
              }
            }
          }
        },
        "description": "Passwords require at least 15 Unicode characters and at most 256 UTF-8 bytes. Store only a slow salted hash. DELETE removes the additional password; the publishing key remains required when ingest is implemented. Active publishers are disconnected when the change succeeds."
      },
      "delete": {
        "summary": "Remove the additional feed password",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "has_publish_password": false
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-CSRF-Token",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Obtained from login or GET /api/v1/session"
          }
        ],
        "description": "Passwords require at least 15 Unicode characters and at most 256 UTF-8 bytes. Store only a slow salted hash. DELETE removes the additional password; the publishing key remains required when ingest is implemented. Active publishers are disconnected when the change succeeds."
      }
    },
    "/api/v1/defaults": {
      "get": {
        "summary": "Read default profile, stream cap, and media availability",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "profile": {
                      "video_codec": "h264",
                      "audio_codec": "aac",
                      "audio_bitrate_kbps": 128,
                      "preset": "veryfast",
                      "segment_seconds": 4,
                      "renditions": [
                        {
                          "name": "720p",
                          "width": 1280,
                          "height": 720,
                          "bitrate_kbps": 2500,
                          "fps": 30
                        },
                        {
                          "name": "480p",
                          "width": 854,
                          "height": 480,
                          "bitrate_kbps": 1000,
                          "fps": 30
                        }
                      ]
                    },
                    "max_streams": 100,
                    "media_available": false,
                    "ingest": {
                      "rtmp_listen": "127.0.0.1:1935",
                      "rtmps_listen": ""
                    }
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "description": "Returns default profile, stream cap, enabled media availability and configured ingest listener addresses. Listener addresses are not necessarily publicly reachable."
      }
    },
    "/api/v1/server/state": {
      "get": {
        "summary": "Read Go runtime statistics and implemented feature flags",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "application": "Woodcock Vision",
                    "version": "0.3.1-dev",
                    "milestone": "M2/M3 streaming development",
                    "uptime_seconds": 120,
                    "go_heap_bytes": 1572864,
                    "media_available": false,
                    "features": {
                      "stream_configuration": true,
                      "rtmp_ingest": false,
                      "transcoding": false,
                      "hls": false,
                      "cachefly": false
                    }
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "description": "Authenticated application statistics and capability flags. Go heap is not total process/host RAM. Missing media features are explicitly false. No CDN audience count or total-host CPU claim is made."
      }
    },
    "/health/live": {
      "get": {
        "summary": "Minimal process liveness",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "status": "alive"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "security": [],
        "description": "Unauthenticated process liveness. It does not prove database readiness or streaming capability."
      }
    },
    "/health/ready": {
      "get": {
        "summary": "Minimal database readiness",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "request_id"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "request_id": {
                      "type": "string"
                    }
                  }
                },
                "example": {
                  "data": {
                    "status": "ready",
                    "application": "Woodcock Vision",
                    "version": "0.3.1-dev"
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          },
          "default": {
            "description": "Validation, authentication, capacity, or server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": {
                    "code": "validation",
                    "message": "Request could not be accepted."
                  },
                  "request_id": "<request_id>"
                }
              }
            }
          }
        },
        "security": [],
        "description": "Unauthenticated database readiness plus application/release identity for local setup checks. It does not prove streaming capability."
      }
    },
    "/hls/{name}/index.m3u8": {
      "get": {
        "summary": "Redirect a stable public stream name to its active HLS generation",
        "description": "No cookie or publishing credentials required. Returns 307 Temporary Redirect with Cache-Control: no-store to /hls/{id}/{generation}/index.m3u8 when the named stream is enabled and live; returns 404 when offline, disabled, unknown, or media is disabled. Allows embedded players to survive publisher reconnects without reusing cached segment URLs.",
        "security": [],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
            }
          }
        ],
        "responses": {
          "307": {
            "description": "Temporary redirect to active HLS master playlist"
          },
          "404": {
            "description": "Stream offline, disabled, unknown, or media disabled"
          }
        }
      }
    },
    "/hls/{id}/{generation}/{file}": {
      "get": {
        "summary": "Read public live HLS manifests and MPEG-TS segments",
        "description": "No cookie or publishing credentials required. Paths come from playback_url and variant manifests. Only complete files in the active generation are served; stopped, disabled, changed or obsolete generations return 404. No directory listing or CORS. Same configured Host policy and HTTP concurrency limits apply. file can include the rendition subdirectory. Manifests are no-store; segments use public max-age=30.",
        "security": [],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "generation",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "file",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Complete HLS manifest or MPEG-TS segment",
            "content": {
              "application/vnd.apple.mpegurl": {
                "schema": {
                  "type": "string"
                }
              },
              "video/mp2t": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "404": {
            "description": "No active complete file"
          },
          "503": {
            "description": "HTTP request capacity reached"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "sessionCookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "wv_session"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "required": [
          "error",
          "request_id"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          },
          "request_id": {
            "type": "string"
          }
        },
        "description": "Matched API handlers return this envelope; generic HTTP 404/405 routing responses can be plain text."
      },
      "Rendition": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "width",
          "height",
          "bitrate_kbps",
          "fps"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
          },
          "width": {
            "type": "integer",
            "minimum": 160,
            "maximum": 3840,
            "multipleOf": 2
          },
          "height": {
            "type": "integer",
            "minimum": 90,
            "maximum": 2160,
            "multipleOf": 2
          },
          "bitrate_kbps": {
            "type": "integer",
            "minimum": 100,
            "maximum": 25000
          },
          "fps": {
            "type": "integer",
            "minimum": 1,
            "maximum": 60
          }
        }
      },
      "Profile": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "video_codec",
          "audio_codec",
          "audio_bitrate_kbps",
          "preset",
          "segment_seconds",
          "renditions"
        ],
        "properties": {
          "video_codec": {
            "const": "h264"
          },
          "audio_codec": {
            "const": "aac"
          },
          "audio_bitrate_kbps": {
            "type": "integer",
            "minimum": 32,
            "maximum": 320
          },
          "preset": {
            "enum": [
              "ultrafast",
              "superfast",
              "veryfast",
              "faster",
              "fast",
              "medium",
              "slow",
              "slower",
              "veryslow"
            ]
          },
          "segment_seconds": {
            "type": "integer",
            "minimum": 2,
            "maximum": 10
          },
          "renditions": {
            "type": "array",
            "minItems": 1,
            "maxItems": 6,
            "items": {
              "$ref": "#/components/schemas/Rendition"
            }
          }
        }
      },
      "StreamInput": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$"
          },
          "description": {
            "type": "string",
            "description": "At most 1024 UTF-8 bytes"
          },
          "enabled": {
            "type": "boolean",
            "default": false
          },
          "profile": {
            "$ref": "#/components/schemas/Profile",
            "description": "Defaults to the server profile when omitted at creation. A supplied PATCH profile replaces the entire profile."
          }
        }
      },
      "Stream": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "profile": {
            "$ref": "#/components/schemas/Profile"
          },
          "has_publish_password": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "disabled",
              "media_disabled",
              "waiting",
              "starting",
              "live",
              "error"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "playback_url": {
            "type": "string",
            "description": "Public relative HLS master URL, present only when every rendition is ready. Generation changes after every reconnect."
          },
          "channel_url": {
            "type": "string",
            "description": "Stable public relative HLS redirect URL (/hls/{name}/index.m3u8) present when enabled and media is available. Redirects (307, no-store) to the active generation when live."
          },
          "media_error": {
            "type": "string",
            "description": "Sanitized worker failure code, when status is error. Cleared on reconnect or settings change."
          }
        }
      },
      "Session": {
        "type": "object",
        "properties": {
          "csrf_token": {
            "type": "string"
          },
          "authenticated": {
            "type": "boolean"
          }
        }
      },
      "KeyResult": {
        "type": "object",
        "properties": {
          "publishing_key": {
            "type": "string",
            "description": "Displayed once; never returned by listing"
          },
          "key_notice": {
            "type": "string"
          }
        }
      },
      "CreateResult": {
        "type": "object",
        "properties": {
          "stream": {
            "$ref": "#/components/schemas/Stream"
          },
          "publishing_key": {
            "type": "string"
          },
          "key_notice": {
            "type": "string"
          }
        }
      }
    }
  }
}
