{
  "openapi": "3.1.0",
  "info": {
    "title": "Reelpipe Public API",
    "version": "1.0.0",
    "summary": "Scene-based programmatic video rendering API.",
    "description": "Submit ordered scenes (images, video clips, voice-over audio, subtitles, and background music) and receive a finished MP4 billed per second of output."
  },
  "servers": [
    {
      "url": "https://reelpipe.dev/api/v1",
      "description": "Reelpipe API v1"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Health check",
        "description": "Public health endpoint. Requires no authentication and is exempt from rate limits.",
        "security": [],
        "responses": {
          "200": {
            "description": "API is healthy",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "status"
                  ],
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "ok"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/renders": {
      "post": {
        "operationId": "createRender",
        "summary": "Create a render job",
        "description": "Validates the scene payload, reserves estimated credits in live mode, and enqueues the render. Supports the Idempotency-Key header (returns 200 on replay).",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "description": "Optional key (up to 255 characters) to safely retry POST /renders without creating duplicate jobs.",
            "schema": {
              "type": "string",
              "maxLength": 255
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Existing render returned for a matching Idempotency-Key",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRenderResponse"
                }
              }
            }
          },
          "201": {
            "description": "Render queued",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateRenderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid payload or plan/test-key limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing, invalid, or revoked API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient credits for live render",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 1 MB",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Per-minute rate limit (60 req/min) or daily test render cap (20/day) exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              },
              "Retry-After": {
                "description": "Seconds until the caller may retry.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "get": {
        "operationId": "listRenders",
        "summary": "List renders",
        "description": "Returns the authenticated user's renders, newest first, with opaque cursor pagination.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Maximum number of renders to return (1–100, default 20).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque cursor returned as next_cursor by a previous page.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated render list",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListRendersResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid limit or cursor parameter",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/renders/validate": {
      "post": {
        "operationId": "validateRender",
        "summary": "Validate a render payload (dry run)",
        "description": "Runs schema and plan/mode limit validation and returns estimated duration and cost without queuing a job or reserving credits.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RenderPayload"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Validation result",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidateRenderResponse"
                }
              }
            }
          },
          "400": {
            "description": "Malformed or empty JSON body",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds 1 MB",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/renders/{id}": {
      "get": {
        "operationId": "getRender",
        "summary": "Get render status and output",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Render UUID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Render details",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Render"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Render not found or belongs to another account",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      },
      "delete": {
        "operationId": "cancelRender",
        "summary": "Cancel a queued render",
        "description": "Cancels a render if its status is still queued, releasing any reserved live credits and triggering a render.canceled webhook.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Render UUID",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Render canceled",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "status"
                  ],
                  "properties": {
                    "id": {
                      "type": "string",
                      "format": "uuid"
                    },
                    "status": {
                      "type": "string",
                      "const": "canceled"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Render not found",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "409": {
            "description": "Render is no longer queued and cannot be canceled",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/usage": {
      "get": {
        "operationId": "getUsage",
        "summary": "Get account plan, credit balance, and monthly usage",
        "responses": {
          "200": {
            "description": "Usage summary",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UsageResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "headers": {
              "X-RateLimit-Limit": {
                "description": "Maximum requests allowed in the current 1-minute window (60).",
                "schema": {
                  "type": "integer",
                  "example": 60
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Remaining requests in the current 1-minute window.",
                "schema": {
                  "type": "integer",
                  "example": 59
                }
              },
              "X-RateLimit-Reset": {
                "description": "Unix timestamp (seconds) when the current rate limit window resets.",
                "schema": {
                  "type": "integer",
                  "example": 1795689060
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Reelpipe API key prefixed with rk_live_ (billable) or rk_test_ (free 480p watermarked)."
      }
    },
    "schemas": {
      "Scene": {
        "type": "object",
        "required": [
          "type",
          "src"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ]
          },
          "src": {
            "type": "string",
            "format": "uri",
            "description": "HTTPS URL to the scene image or video clip."
          },
          "voice": {
            "type": "string",
            "format": "uri",
            "description": "Optional HTTPS URL to a voice-over audio file."
          },
          "duration": {
            "type": "number",
            "minimum": 0.5,
            "maximum": 600,
            "description": "Optional scene duration in seconds (0.5–600). Defaults at render time to voice length + 0.3s, or 5s without voice; estimation uses 8s when omitted."
          },
          "subtitle": {
            "type": "string",
            "maxLength": 500,
            "description": "Optional caption text rendered for this scene."
          },
          "motion": {
            "type": "string",
            "enum": [
              "zoom-in",
              "zoom-out",
              "pan-left",
              "pan-right",
              "none"
            ]
          },
          "fit": {
            "type": "string",
            "enum": [
              "loop",
              "slow",
              "freeze",
              "cut"
            ]
          },
          "transition": {
            "type": "string",
            "enum": [
              "none",
              "fade",
              "crossfade"
            ]
          }
        }
      },
      "Music": {
        "type": "object",
        "required": [
          "src"
        ],
        "properties": {
          "src": {
            "type": "string",
            "format": "uri",
            "description": "HTTPS URL to the background music audio file."
          },
          "volume": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "ducking": {
            "type": "boolean",
            "description": "Automatically lower music volume when voice-over plays."
          }
        }
      },
      "SubtitlesConfig": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "style": {
            "type": "string",
            "maxLength": 64
          }
        }
      },
      "RenderPayload": {
        "type": "object",
        "required": [
          "format",
          "scenes"
        ],
        "properties": {
          "format": {
            "type": "string",
            "enum": [
              "16:9",
              "9:16",
              "1:1"
            ]
          },
          "resolution": {
            "type": "string",
            "enum": [
              "720p",
              "1080p"
            ],
            "default": "720p"
          },
          "fps": {
            "type": "integer",
            "enum": [
              24,
              25,
              30
            ],
            "default": 30
          },
          "preset": {
            "type": "string",
            "enum": [
              "documentary",
              "short",
              "none"
            ],
            "default": "none"
          },
          "scenes": {
            "type": "array",
            "minItems": 1,
            "maxItems": 1000,
            "items": {
              "$ref": "#/components/schemas/Scene"
            }
          },
          "music": {
            "$ref": "#/components/schemas/Music"
          },
          "subtitles": {
            "$ref": "#/components/schemas/SubtitlesConfig"
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional per-render HTTPS webhook destination (overrides default webhook URL)."
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true,
            "description": "Arbitrary JSON object up to 4 KB UTF-8, echoed on GET /renders/{id} and webhooks."
          }
        }
      },
      "CreateRenderResponse": {
        "type": "object",
        "required": [
          "id",
          "status",
          "estimated_seconds",
          "created_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/RenderStatus"
          },
          "estimated_seconds": {
            "type": "integer"
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "RenderStatus": {
        "type": "string",
        "enum": [
          "queued",
          "downloading",
          "rendering",
          "uploading",
          "done",
          "failed",
          "canceled"
        ]
      },
      "RenderError": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Render": {
        "type": "object",
        "required": [
          "id",
          "status",
          "progress",
          "mode",
          "estimated_seconds",
          "duration_seconds",
          "billed_seconds",
          "output_url",
          "output_expired",
          "error",
          "metadata",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "$ref": "#/components/schemas/RenderStatus"
          },
          "progress": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "mode": {
            "type": "string",
            "enum": [
              "live",
              "test"
            ]
          },
          "estimated_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "duration_seconds": {
            "type": [
              "number",
              "null"
            ]
          },
          "billed_seconds": {
            "type": [
              "integer",
              "null"
            ]
          },
          "output_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri",
            "description": "Fresh presigned download URL valid for 1 hour while the MP4 is within plan retention; null before completion or once purged."
          },
          "output_expired": {
            "type": "boolean",
            "description": "True once the output MP4 has been purged after the plan retention window (7 or 30 days)."
          },
          "error": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RenderError"
              },
              {
                "type": "null"
              }
            ]
          },
          "metadata": {
            "type": "object",
            "additionalProperties": true
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        }
      },
      "ListRendersResponse": {
        "type": "object",
        "required": [
          "data",
          "next_cursor"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Render"
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      },
      "ValidationIssue": {
        "type": "object",
        "required": [
          "field",
          "message"
        ],
        "properties": {
          "field": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "ValidateRenderResponse": {
        "type": "object",
        "required": [
          "valid",
          "errors",
          "estimated_seconds",
          "estimated_cost_minutes"
        ],
        "properties": {
          "valid": {
            "type": "boolean"
          },
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            }
          },
          "estimated_seconds": {
            "type": "integer"
          },
          "estimated_cost_minutes": {
            "type": "number"
          }
        }
      },
      "UsageResponse": {
        "type": "object",
        "required": [
          "plan",
          "balance_seconds",
          "balance_minutes",
          "consumed_seconds",
          "renders_this_month"
        ],
        "properties": {
          "plan": {
            "type": "string",
            "enum": [
              "free",
              "starter",
              "pro",
              "scale"
            ]
          },
          "balance_seconds": {
            "type": "integer"
          },
          "balance_minutes": {
            "type": "number"
          },
          "consumed_seconds": {
            "type": "integer"
          },
          "renders_this_month": {
            "type": "integer"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "invalid_payload",
                  "invalid_api_key",
                  "insufficient_credits",
                  "not_found",
                  "cannot_cancel",
                  "too_large",
                  "media_unreachable",
                  "media_invalid",
                  "rate_limited",
                  "internal"
                ]
              },
              "message": {
                "type": "string"
              },
              "field": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}