{
  "openapi": "3.1.0",
  "info": {
    "title": "find-scene API",
    "version": "1.0.0",
    "description": "API for searching and downloading movie/TV show scenes by dialog, time, or visual description.",
    "termsOfService": "https://find-scene.com/terms",
    "contact": {
      "email": "support@find-scene.com",
      "url": "https://find-scene.com"
    }
  },
  "servers": [
    {
      "url": "https://api.find-scene.com"
    }
  ],
  "components": {
    "schemas": {
      "TokenField": {
        "type": "object",
        "properties": {
          "_token": {
            "type": "string",
            "description": "API token obtained from the find-scene bot. Include in the JSON body of every request."
          }
        },
        "required": [
          "_token"
        ]
      },
      "SrtOccurrence": {
        "type": "object",
        "properties": {
          "time": {
            "type": "string"
          },
          "rangeStart": {
            "type": "string"
          },
          "rangeEnd": {
            "type": "string"
          },
          "srt": {
            "type": "string"
          }
        }
      },
      "SceneSearchResult": {
        "type": "object",
        "properties": {
          "query": {
            "type": "object",
            "additionalProperties": true
          },
          "time": {
            "type": "string"
          },
          "score": {
            "type": "number"
          }
        }
      }
    }
  },
  "paths": {
    "/api/get_best_video_source": {
      "post": {
        "operationId": "get_best_video_source",
        "summary": "Find the best video source (async; do not poll). Only title is required (+ season/episode for series; never retry an episode title as a movie), plus optional phrase for single-pass lookup. IMDb/year auto-resolve — never call query_imdb first. For a multi-film franchise, verify the exact film via quote_to_movie/web search first. For dubbed audio, pass canonical code (\"en\", \"pt-br\", \"uk\", \"ta\", \"te\"; omit for native audio) and include any localized release title in aliases in the same call — original-audio fallback sources are returned automatically if no dub exists. On open-ended queries, do not probe a waterfall of movies (max 2 titles), then call download_by_time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "Only the title is required (plus season & episode for series); optional when imdb is provided.",
                        "type": "string"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code (\"en\", \"es\", \"pt-br\", \"ru\", \"uk\", \"ja\", \"ta\", \"te\"). Only specify when the requested audio is a translation/dub different from the production original language (omit for native audio). Pass any localized release title in aliases in the same call; if no dubbed source exists, original-audio fallback sources are returned automatically unless fallbackToOriginalAudio is false.",
                        "type": "string"
                      },
                      "year": {
                        "description": "Optional release year (automatically resolved).",
                        "type": "number"
                      },
                      "isSeries": {
                        "description": "Set true for TV series. When true, both 'season' (number) and 'episode' (number) MUST be provided.",
                        "type": "boolean"
                      },
                      "season": {
                        "description": "TV season number. Individual episode identification is mandatory.",
                        "type": "number"
                      },
                      "episode": {
                        "description": "TV episode number. Individual episode identification is mandatory.",
                        "type": "number"
                      },
                      "imdb": {
                        "description": "Optional IMDb ID (automatically resolved from title — do NOT call query_imdb first).",
                        "type": "string"
                      },
                      "aliases": {
                        "description": "Optional alternative/localized titles (automatically searched alongside title and imdb in the same call — never retry separately with an alias you already passed).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "timeoutSeconds": {
                        "description": "Optional max wait in seconds (default 45, max 120).",
                        "type": "number"
                      },
                      "phrase": {
                        "description": "Optional dialogue phrase to locate in aligned subtitles in the same pass (returns textSourceHashes + occurrences so you can call download_by_time directly).",
                        "type": "string"
                      },
                      "includeTextSource": {
                        "description": "Set true to also return aligned textSourceHashes in the same pass.",
                        "type": "boolean"
                      },
                      "language": {
                        "description": "Optional subtitle language code when phrase/includeTextSource is set (default 'en').",
                        "type": "string"
                      },
                      "secondsBefore": {
                        "description": "Context seconds before matched phrase (default 20).",
                        "type": "number"
                      },
                      "secondsAfter": {
                        "description": "Context seconds after matched phrase (default 25).",
                        "type": "number"
                      },
                      "fallbackToOriginalAudio": {
                        "description": "When dubbed is specified and no dubbed sources exist, automatically return labeled original-audio fallback sources in the same call (default true).",
                        "type": "boolean"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/compute_running_time": {
      "post": {
        "operationId": "compute_running_time",
        "summary": "Compute the running time of a video.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "imdb": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "imdb"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "runtimeSeconds": {
                          "type": [
                            "number",
                            "null"
                          ]
                        }
                      },
                      "required": [
                        "runtimeSeconds"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/find_clip_context": {
      "post": {
        "operationId": "find_clip_context",
        "summary": "Find the original full-length video, broadcast, interview, podcast, or movie/TV source and surrounding before/after context for a short video clip or X/Twitter video post. Analyzes the clip's audio, speech, and on-screen chyrons, searches for full-length uploads, aligns transcripts to verify the exact source video and timestamps where the clip was cut from, and returns what was said right before and after the cut along with ready-to-clip surrounding time windows.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "tweetOrPostUrl": {
                        "description": "Optional X/Twitter post URL (e.g. https://x.com/user/status/123) or numeric tweet ID containing the clip.",
                        "type": "string"
                      },
                      "videoUrl": {
                        "description": "Optional direct video MP4 URL of the short clip (e.g. https://video.twimg.com/... from thread context).",
                        "type": "string"
                      },
                      "thumbnailUrl": {
                        "description": "Optional preview/thumbnail image URL of the clip.",
                        "type": "string"
                      },
                      "postText": {
                        "description": "Optional caption/text of the post or thread containing the clip.",
                        "type": "string"
                      },
                      "author": {
                        "description": "Optional handle or name of the account that posted the clip (e.g. @C14_news).",
                        "type": "string"
                      },
                      "postedAt": {
                        "description": "Optional ISO timestamp or date string when the clip was posted.",
                        "type": "string"
                      },
                      "userQuestion": {
                        "description": "Optional user request describing what context they are looking for (e.g. 'full interview', 'what happened before this', 'what movie is this').",
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "mediaKind": {
                              "type": "string",
                              "enum": [
                                "movie_or_tv",
                                "broadcast_or_web"
                              ]
                            },
                            "title": {
                              "type": "string"
                            },
                            "season": {
                              "type": "number"
                            },
                            "episode": {
                              "type": "number"
                            },
                            "noConfidentMatch": {
                              "type": "boolean"
                            },
                            "channelOrNetwork": {
                              "type": "string"
                            },
                            "speakers": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "clipSummary": {
                              "type": "string"
                            },
                            "verbatimQuotes": {
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "sources": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "url": {
                                    "type": "string"
                                  },
                                  "timestampedUrl": {
                                    "type": "string"
                                  },
                                  "title": {
                                    "type": "string"
                                  },
                                  "channel": {
                                    "type": "string"
                                  },
                                  "duration": {
                                    "type": "string"
                                  },
                                  "durationSeconds": {
                                    "type": "number"
                                  },
                                  "publishedAt": {
                                    "type": "string"
                                  },
                                  "captionVerified": {
                                    "type": "boolean"
                                  },
                                  "matchConfidence": {
                                    "type": "number"
                                  },
                                  "clipStartInSource": {
                                    "type": "string"
                                  },
                                  "clipEndInSource": {
                                    "type": "string"
                                  },
                                  "transcriptBefore": {
                                    "type": "string"
                                  },
                                  "transcriptAfter": {
                                    "type": "string"
                                  },
                                  "beforeClipWindow": {
                                    "type": "object",
                                    "properties": {
                                      "startTime": {
                                        "type": "string"
                                      },
                                      "endTime": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "afterClipWindow": {
                                    "type": "object",
                                    "properties": {
                                      "startTime": {
                                        "type": "string"
                                      },
                                      "endTime": {
                                        "type": "string"
                                      }
                                    }
                                  }
                                },
                                "required": [
                                  "url",
                                  "title",
                                  "channel",
                                  "duration",
                                  "durationSeconds",
                                  "captionVerified",
                                  "matchConfidence"
                                ]
                              }
                            },
                            "webMatches": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "title": {
                                    "type": "string"
                                  },
                                  "url": {
                                    "type": "string"
                                  },
                                  "description": {
                                    "type": "string"
                                  }
                                }
                              }
                            }
                          },
                          "required": [
                            "mediaKind",
                            "speakers",
                            "clipSummary",
                            "verbatimQuotes",
                            "sources",
                            "webMatches"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/get_high_accuracy_text_source": {
      "post": {
        "operationId": "get_high_accuracy_text_source",
        "summary": "Schedules a task to get aligned subtitle text sources for a given video source (language defaults to \"en\"; omitting language is identical to passing \"en\"). The result will be automatically delivered when complete. You will be notified when the operation finishes — do not poll or check status. DO NOT call this if you already found timestamps for the scene from an earlier text source — proceed directly to download_by_time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "language": {
                        "description": "Subtitle language code (ISO 639-1, e.g. \"en\", \"es\", \"pt-br\", \"uk\", \"ja\"). Defaults to \"en\" when omitted — omitting language is identical to passing \"en\", so never call twice with and without language. Country codes, 3-letter codes, and language names are normalized (\"ua\"/\"ukrainian\" -> \"uk\").",
                        "type": "string"
                      },
                      "videoSourceHash": {
                        "description": "Must come directly from a prior call to video_sources/get_best_video_source (videoSourceHashes), e.g. video-3b7da43b43. Do not pass unverified, cached, or invented hash strings.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      }
                    },
                    "required": [
                      "videoSourceHash"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/get_text_source": {
      "post": {
        "operationId": "get_text_source",
        "summary": "Schedules a task to get a text source for given video details (requires title or imdb ID — NEVER call with only language or before identifying a specific video title; use quote_to_movie first if you only have a quote). If you have the video source use get_high_accuracy_text_source instead, it will be more accurate with the timings. Note that this outputs a text source hash. NOT a video source hash. The result will be automatically delivered when complete. You will be notified when the operation finishes — do not poll or check status. DO NOT call this if you already found timestamps for the scene — proceed directly to download_by_time.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "REQUIRED (unless imdb is provided). The exact movie or TV show title only. Do NOT call get_text_source with only language or before identifying a specific video title — if you only have a quote, use quote_to_movie first.",
                        "type": "string"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code (\"en\", \"es\", \"pt-br\", \"ru\", \"uk\", \"ja\", \"ta\", \"te\"). Only specify when the requested audio is a translation/dub different from the production original language (omit for native audio). Pass any localized release title in aliases in the same call; if no dubbed source exists, original-audio fallback sources are returned automatically unless fallbackToOriginalAudio is false.",
                        "type": "string"
                      },
                      "year": {
                        "description": "Release year if known.",
                        "type": "number"
                      },
                      "isSeries": {
                        "description": "True for TV series (requires season and episode; inferred if provided).",
                        "type": "boolean"
                      },
                      "season": {
                        "description": "TV season number (required for series).",
                        "type": "number"
                      },
                      "episode": {
                        "description": "TV episode number (required for series).",
                        "type": "number"
                      },
                      "imdb": {
                        "description": "The IMDB id (e.g. tt0133093). Optional when title is provided.",
                        "type": "string"
                      },
                      "aliases": {
                        "description": "Optional alternative/localized titles (automatically searched alongside title and imdb in the same call — never retry separately with an alias you already passed).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "language": {
                        "description": "Subtitle language code (ISO 639-1, e.g. \"en\", \"es\", \"pt-br\", \"uk\", \"ja\"). Defaults to \"en\" when omitted — omitting language is identical to passing \"en\", so never call twice with and without language. Country codes, 3-letter codes, and language names are normalized (\"ua\"/\"ukrainian\" -> \"uk\").",
                        "type": "string"
                      },
                      "minDuration": {
                        "description": "If provided, only return subtitles where the final entry time end time is larger than this number of seconds.",
                        "type": "number"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/search_phrase": {
      "post": {
        "operationId": "search_phrase",
        "summary": "Search for a phrase within a specific subtitle text source and return matching occurrences with start/end time ranges and subtitle context. This is NOT a global search: you MUST pass a textSourceHash (a 'text-...' hash that must come directly from a prior call to text_sources endpoints: get_high_accuracy_text_source or get_text_source). Once timestamps are found, proceed directly to downloading with download_by_time — DO NOT call get_srt_entries_around_phrase or get_srt_entries_by_time_range for the same phrase, as that duplicates searches.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "nSkip": {
                        "description": "Number of grouped occurrence windows to skip (0-indexed; pass nextSkip from the previous response to paginate forward)",
                        "default": 0,
                        "type": "number"
                      },
                      "maxOccurrences": {
                        "description": "Max number of grouped occurrence windows to return (defaults to 5)",
                        "default": 5,
                        "type": "number"
                      },
                      "phrase": {
                        "description": "if ellipsis was used or the text is more than 3 sentences long, split it using `phraseEnd`. do not include speaker names",
                        "type": "string"
                      },
                      "phraseEnd": {
                        "description": "The end of the phrase, if any",
                        "type": "string"
                      },
                      "textSourceHash": {
                        "description": "Must come directly from a prior call to text_sources (get_high_accuracy_text_source/get_text_source, textSourceHashes), e.g. text-eb354dfaa7.",
                        "type": "string",
                        "pattern": "^text-[0-9a-fA-F]{10}$"
                      },
                      "secondsBefore": {
                        "description": "Seconds before the phrase to include in the scene range and subtitle context (default: 5, use 10-20 to capture the full contextual scene)",
                        "type": "number"
                      },
                      "secondsAfter": {
                        "description": "Seconds after the phrase to include in the scene range and subtitle context (default: 5, use 10-20 to capture the full contextual scene)",
                        "type": "number"
                      }
                    },
                    "required": [
                      "phrase",
                      "textSourceHash"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "occurrences": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/SrtOccurrence"
                              }
                            },
                            "totalOccurrences": {
                              "type": "number"
                            },
                            "nextSkip": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "occurrences"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/get_srt_entries_around_phrase": {
      "post": {
        "operationId": "get_srt_entries_around_phrase",
        "summary": "Get subtitle entries (text and times) around a phrase, for a given video. Returns entries within a time window before and after the phrase. The textSourceHash must come directly from a prior call to text_sources endpoints (get_high_accuracy_text_source or get_text_source). Prefer search_phrase for dialogue searches; DO NOT call this after search_phrase for the same phrase, as that duplicates searches.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "limit": {
                        "default": 1,
                        "description": "Max number of sections to return, if the phrase occurs many times.",
                        "type": "number"
                      },
                      "skip": {
                        "default": 0,
                        "description": "Skip this many phrase occurrences, e.g. if user asked for the next match.",
                        "type": "number"
                      },
                      "textSourceHash": {
                        "description": "Must come directly from a prior call to text_sources (get_high_accuracy_text_source/get_text_source, textSourceHashes), e.g. text-eb354dfaa7.",
                        "type": "string",
                        "pattern": "^text-[0-9a-fA-F]{10}$"
                      },
                      "phrase": {
                        "type": "string"
                      },
                      "secondsBefore": {
                        "default": 5,
                        "description": "Seconds before the phrase to include",
                        "type": "number"
                      },
                      "secondsAfter": {
                        "default": 5,
                        "description": "Seconds after the phrase to include",
                        "type": "number"
                      }
                    },
                    "required": [
                      "textSourceHash",
                      "phrase"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "occurrences": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/SrtOccurrence"
                              }
                            },
                            "totalOccurrences": {
                              "type": "number"
                            },
                            "nextSkip": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "occurrences"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/get_srt_entries_by_time_range": {
      "post": {
        "operationId": "get_srt_entries_by_time_range",
        "summary": "Get subtitle entries (text and times) for a given video and time range within a specific subtitle text source. The textSourceHash must come directly from a prior call to text_sources endpoints (get_high_accuracy_text_source or get_text_source).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "textSourceHash": {
                        "description": "Must come directly from a prior call to text_sources (get_high_accuracy_text_source/get_text_source, textSourceHashes), e.g. text-eb354dfaa7.",
                        "type": "string",
                        "pattern": "^text-[0-9a-fA-F]{10}$"
                      },
                      "startTime": {
                        "description": "e.g. 00:01:30 or 00:01:30.5",
                        "type": "string"
                      },
                      "endTime": {
                        "description": "e.g. 00:01:30 or 00:01:30.5",
                        "type": "string"
                      }
                    },
                    "required": [
                      "textSourceHash",
                      "startTime",
                      "endTime"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "srt": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "srt"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/download_by_time": {
      "post": {
        "operationId": "download_by_time",
        "summary": "Download and auto-deliver a single video clip (async, 1 credit; do not poll, and do not call again once started/completed). Verify timestamps via subtitles, inspect_frame, or transcribe_by_time before calling — NEVER guess arbitrary timestamps when no text sources were found, never probe audio, and never cut intros/outros (OP/ED). Pass responseLanguage (e.g. 'pt', 'es', 'id', 'fa') on non-English chats so delivery notes/buttons are localized. Do NOT download continuations or overlapping chunks (suggest scrubbing or extract_frame). Omit textSourceHash unless user explicitly asked for burned-in subtitles. Never call send_file or output <video> tags/URLs.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "startTime": {
                        "description": "e.g. 00:01:30 or 00:01:30.5",
                        "type": "string"
                      },
                      "endTime": {
                        "description": "e.g. 00:01:30 or 00:01:30.5",
                        "type": "string"
                      },
                      "srtOffset": {
                        "description": "Subtitle time offset in seconds.",
                        "type": "number"
                      },
                      "dubbed": {
                        "description": "Optional canonical dubbing language code (inferred from source if omitted).",
                        "type": "string"
                      },
                      "videoSourceHash": {
                        "description": "Must come directly from a prior call to video_sources/get_best_video_source (videoSourceHashes), e.g. video-3b7da43b43. Do not pass unverified, cached, or invented hash strings.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      },
                      "textSourceHash": {
                        "description": "OPTIONAL: pass ONLY to burn visible subtitles (omit by default). Must come directly from a prior call to text_sources (get_high_accuracy_text_source/get_text_source).",
                        "type": "string",
                        "pattern": "^text-[0-9a-fA-F]{10}$"
                      },
                      "responseLanguage": {
                        "description": "ISO 639-1 language code of the user's conversation when NOT English (e.g. 'pt', 'es', 'id', 'fa', 'he', 'fr') so clip delivery notes and buttons are localized. Omit for English.",
                        "type": "string"
                      },
                      "displayParams": {
                        "type": "object",
                        "properties": {
                          "removeWatermark": {
                            "description": "This should be false by default unless user asked for something else. Only pro users can set this to true.",
                            "default": false,
                            "type": "boolean"
                          },
                          "gif": {
                            "description": "only use if the user explicitly asked for gif (format for mobile does not imply this)",
                            "default": false,
                            "type": "boolean"
                          },
                          "mobile": {
                            "description": "Crop to vertical/mobile format (9:16). Must be false unless the user explicitly asked for mobile, vertical, 9:16, TikTok, Reels, or Shorts format.",
                            "default": false,
                            "type": "boolean"
                          },
                          "aspectRatio": {
                            "description": "Optional aspect ratio preset: '9:16' (vertical TikTok/Reels/Shorts), '4:5' (Instagram/Feed portrait), '1:1' (square), or 'original' (default widescreen). Supports AI gaze-tracked smart cropping.",
                            "type": "string",
                            "enum": [
                              "original",
                              "9:16",
                              "4:5",
                              "1:1"
                            ]
                          },
                          "cropMode": {
                            "description": "Used when cropping to 9:16, 4:5, or 1:1. 'smart' uses AI gaze tracking to follow the action; 'center' is a static center crop. Defaults to 'smart'.",
                            "default": "smart",
                            "type": "string",
                            "enum": [
                              "smart",
                              "center"
                            ]
                          }
                        }
                      }
                    },
                    "required": [
                      "startTime",
                      "endTime",
                      "videoSourceHash"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/extract_frame": {
      "post": {
        "operationId": "extract_frame",
        "summary": "Extract a full rectangular frame/screenshot from a video at a specific time (with optional meme captions or subtitles). Costs 1 credit and automatically delivers the image to the user. For transparent background-cutout WhatsApp stickers (static or animated), use create_sticker instead. NEVER call this tool to inspect, preview, or verify timestamps or video content before downloading a video clip. ONLY call this tool when the user EXPLICITLY asks for a photo, still image, screenshot, or full-frame meme. You will be notified when the operation finishes — do not poll or check status, and do NOT call again once started or completed. Do NOT pass textSourceHash unless the user explicitly asked for subtitles/captions overlaid on the frame. Do NOT call send_file — the frame is automatically delivered directly to the user's chat.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "videoSourceHash": {
                        "description": "Must come directly from a prior call to video_sources/get_best_video_source (videoSourceHashes), e.g. video-3b7da43b43. Do not pass unverified, cached, or invented hash strings.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      },
                      "time": {
                        "description": "e.g. 00:01:30 or 00:01:30.5",
                        "type": "string"
                      },
                      "textSourceHash": {
                        "description": "OPTIONAL: pass ONLY to overlay visible subtitles on the frame (omit by default).",
                        "type": "string",
                        "pattern": "^text-[0-9a-fA-F]{10}$"
                      },
                      "overrideTextTop": {
                        "description": "Top meme overlay text.",
                        "type": "string"
                      },
                      "overrideTextBottom": {
                        "description": "Bottom meme overlay text.",
                        "type": "string"
                      },
                      "responseLanguage": {
                        "description": "ISO 639-1 language code of the user's conversation when NOT English (e.g. 'pt', 'es', 'id', 'fa', 'he', 'fr') so clip delivery notes and buttons are localized. Omit for English.",
                        "type": "string"
                      },
                      "displayParams": {
                        "type": "object",
                        "properties": {
                          "removeWatermark": {
                            "description": "This should be false by default unless user asked for something else. Only pro users can set this to true.",
                            "default": false,
                            "type": "boolean"
                          },
                          "gif": {
                            "description": "only use if the user explicitly asked for gif (format for mobile does not imply this)",
                            "default": false,
                            "type": "boolean"
                          },
                          "mobile": {
                            "description": "Crop to vertical/mobile format (9:16). Must be false unless the user explicitly asked for mobile, vertical, 9:16, TikTok, Reels, or Shorts format.",
                            "default": false,
                            "type": "boolean"
                          },
                          "aspectRatio": {
                            "description": "Optional aspect ratio preset: '9:16' (vertical TikTok/Reels/Shorts), '4:5' (Instagram/Feed portrait), '1:1' (square), or 'original' (default widescreen). Supports AI gaze-tracked smart cropping.",
                            "type": "string",
                            "enum": [
                              "original",
                              "9:16",
                              "4:5",
                              "1:1"
                            ]
                          },
                          "cropMode": {
                            "description": "Used when cropping to 9:16, 4:5, or 1:1. 'smart' uses AI gaze tracking to follow the action; 'center' is a static center crop. Defaults to 'smart'.",
                            "default": "smart",
                            "type": "string",
                            "enum": [
                              "smart",
                              "center"
                            ]
                          }
                        }
                      }
                    },
                    "required": [
                      "videoSourceHash",
                      "time"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/create_sticker": {
      "post": {
        "operationId": "create_sticker",
        "summary": "Cut out the character/subject with a transparent background to create a ready-to-use 512x512 WhatsApp sticker (static or animated!). Static sticker (pass videoSourceHash + time, OR an authentic find-scene imageUrl such as from extract_frame or inspect_frame, plus optional subject): removes the background cleanly with Bria RMBG-3.0, tightly crops and centers into a 512x512 transparent WebP (<100KB), costs 1 credit. Animated sticker (pass videoSourceHash + startTime & endTime <= 6s — keep it 1.5-4s on ONE continuous shot without camera cuts — OR an authentic find-scene videoUrl): removes video background frame-by-frame with Bria VRMBG 3.0 (or SAM 3.1 when 'subject' is specified to isolate ONE character from a multi-character shot — use a short 1-3 word visual noun like 'girl', 'woman', 'man', 'dog' rather than a proper name!) and delivers BOTH a 512x512 transparent looping .gif (copy-paste into WhatsApp -> Send as sticker with no white border) and a 512x512 transparent animated .webp (<500KB), costs 1 credit/sec (min 2 credits). Clean transparent cutout by default (set outline: true only if the user asks for a white sticker border). Only authentic find-scene media is supported. Do NOT call send_file — the sticker is automatically delivered directly to the user's chat.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "videoSourceHash": {
                        "description": "The video source hash (starts with 'video-') from a prior call to get_best_video_source. Provide with 'time' for a static cutout sticker, or with 'startTime' and 'endTime' (<= 6s, ideally 1.5-4s on a single continuous shot) for an animated sticker.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      },
                      "time": {
                        "description": "Timestamp (HH:MM:SS or HH:MM:SS.s, e.g. 00:58:25.5) of the frame to cut into a static WhatsApp sticker when providing videoSourceHash.",
                        "type": "string"
                      },
                      "startTime": {
                        "description": "Start timestamp (HH:MM:SS or HH:MM:SS.s, e.g. 00:58:24.2) of the short reaction clip (<= 6s, ideally 1.5-4s on one continuous shot without camera cuts) for an animated WhatsApp sticker.",
                        "type": "string"
                      },
                      "endTime": {
                        "description": "End timestamp (HH:MM:SS or HH:MM:SS.s, e.g. 00:58:25.6) of the short reaction clip (<= 6s) for an animated WhatsApp sticker.",
                        "type": "string"
                      },
                      "imageUrl": {
                        "description": "Direct URL of an authentic find-scene movie frame (e.g. from https://api.find-scene.com/s/... or extract_frame) to cut into a static sticker without re-extracting from video. External uploads are not supported.",
                        "type": "string",
                        "format": "uri"
                      },
                      "videoUrl": {
                        "description": "Direct URL of an authentic find-scene short clip (e.g. from https://api.find-scene.com/s/...) to turn into an animated cutout sticker. External uploads are not supported.",
                        "type": "string",
                        "format": "uri"
                      },
                      "subject": {
                        "description": "Optional description of WHICH character or object to keep (works for BOTH static and animated stickers!). When multiple characters are in the shot and the user wants only one (e.g. only Ariel without the prince), pass a short visual phrase SAM/RMBG can detect — e.g. 'girl', 'woman', 'man', 'dog', 'woman in blue dress', 'man on the left' (for animated stickers, prefer a simple 1-3 word visual noun like 'girl' or 'woman' rather than a character proper name like 'Ariel'). Omit to keep all main foreground subjects.",
                        "type": "string"
                      },
                      "outline": {
                        "description": "Add a white die-cut sticker outline around the cutout (default: false for a clean transparent cutout; set true only if the user explicitly asks for a white sticker border).",
                        "default": false,
                        "type": "boolean"
                      },
                      "textTop": {
                        "description": "Optional short reaction/meme caption rendered at the top of the sticker.",
                        "type": "string"
                      },
                      "textBottom": {
                        "description": "Optional short reaction/meme caption rendered at the bottom of the sticker.",
                        "type": "string"
                      },
                      "responseLanguage": {
                        "description": "ISO 639-1 language code of the user's conversation when NOT English (e.g. 'pt', 'es', 'id', 'fa', 'he', 'fr') so clip delivery notes and buttons are localized. Omit for English.",
                        "type": "string"
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/stitch_videos": {
      "post": {
        "operationId": "stitch_videos",
        "summary": "Stitch multiple previously downloaded video clips into a single video. Accepts URLs from completed download_by_time operations. The result will be automatically delivered to the user (UI + email) and billed when complete. You will be notified when the operation finishes — do not poll or check status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "urls": {
                        "description": "Array of video URLs to stitch together in order. These should be URLs from completed download_by_time operations.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "displayParams": {
                        "type": "object",
                        "properties": {
                          "removeWatermark": {
                            "description": "This should be false by default unless user asked for something else. Only pro users can set this to true.",
                            "default": false,
                            "type": "boolean"
                          },
                          "gif": {
                            "description": "only use if the user explicitly asked for gif (format for mobile does not imply this)",
                            "default": false,
                            "type": "boolean"
                          },
                          "mobile": {
                            "description": "Crop to vertical/mobile format (9:16). Must be false unless the user explicitly asked for mobile, vertical, 9:16, TikTok, Reels, or Shorts format.",
                            "default": false,
                            "type": "boolean"
                          },
                          "aspectRatio": {
                            "description": "Optional aspect ratio preset: '9:16' (vertical TikTok/Reels/Shorts), '4:5' (Instagram/Feed portrait), '1:1' (square), or 'original' (default widescreen). Supports AI gaze-tracked smart cropping.",
                            "type": "string",
                            "enum": [
                              "original",
                              "9:16",
                              "4:5",
                              "1:1"
                            ]
                          },
                          "cropMode": {
                            "description": "Used when cropping to 9:16, 4:5, or 1:1. 'smart' uses AI gaze tracking to follow the action; 'center' is a static center crop. Defaults to 'smart'.",
                            "default": "smart",
                            "type": "string",
                            "enum": [
                              "smart",
                              "center"
                            ]
                          }
                        }
                      }
                    },
                    "required": [
                      "urls",
                      "displayParams"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/stitch_videos_side_by_side": {
      "post": {
        "operationId": "stitch_videos_side_by_side",
        "summary": "Place multiple previously downloaded video clips side by side in a single frame. All videos play simultaneously. Accepts URLs from completed download_by_time operations. The result will be automatically delivered to the user (UI + email) and billed when complete. You will be notified when the operation finishes — do not poll or check status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "urls": {
                        "description": "Array of video URLs to stitch together in order. These should be URLs from completed download_by_time operations.",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "displayParams": {
                        "type": "object",
                        "properties": {
                          "removeWatermark": {
                            "description": "This should be false by default unless user asked for something else. Only pro users can set this to true.",
                            "default": false,
                            "type": "boolean"
                          },
                          "gif": {
                            "description": "only use if the user explicitly asked for gif (format for mobile does not imply this)",
                            "default": false,
                            "type": "boolean"
                          },
                          "mobile": {
                            "description": "Crop to vertical/mobile format (9:16). Must be false unless the user explicitly asked for mobile, vertical, 9:16, TikTok, Reels, or Shorts format.",
                            "default": false,
                            "type": "boolean"
                          },
                          "aspectRatio": {
                            "description": "Optional aspect ratio preset: '9:16' (vertical TikTok/Reels/Shorts), '4:5' (Instagram/Feed portrait), '1:1' (square), or 'original' (default widescreen). Supports AI gaze-tracked smart cropping.",
                            "type": "string",
                            "enum": [
                              "original",
                              "9:16",
                              "4:5",
                              "1:1"
                            ]
                          },
                          "cropMode": {
                            "description": "Used when cropping to 9:16, 4:5, or 1:1. 'smart' uses AI gaze tracking to follow the action; 'center' is a static center crop. Defaults to 'smart'.",
                            "default": "smart",
                            "type": "string",
                            "enum": [
                              "smart",
                              "center"
                            ]
                          }
                        }
                      }
                    },
                    "required": [
                      "urls",
                      "displayParams"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/cancel_operation": {
      "post": {
        "operationId": "cancel_operation",
        "summary": "Cancel a stuck async operation by its ID.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "id": {
                        "description": "The operation ID to cancel",
                        "type": "string"
                      }
                    },
                    "required": [
                      "id"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "cancelled": {
                              "type": "boolean",
                              "const": true
                            },
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "cancelled",
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "cancelled": {
                              "type": "boolean",
                              "const": false
                            },
                            "reason": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "cancelled",
                            "reason"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/modify_scene": {
      "post": {
        "operationId": "modify_scene",
        "summary": "Modify or transform a movie scene using generative AI (fal.ai / MiniMax H3 Max). Available ONLY for paying Pro users. Takes a movie frame or video clip (from videoSourceHash with timestamp/time-range, or via an authentic find-scene media URL: imageUrl or videoUrl) and transforms it based on a visual prompt, with optional dialogue spoken by the character with lip sync. Only authentic find-scene movie scenes, frames, and video clips can be modified — external uploads or third-party URLs are not supported. Costs 4 credits per second of output video (20 credits for 5s at 768P, 15 credits at 480P). Always explicitly state to the user how many credits each generation will take. For example, make a character perform new actions, summon objects, or completely transform the scene. The result will be automatically delivered to the user when complete. You will be notified when the operation finishes — do not poll or check status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "videoSourceHash": {
                        "description": "The video source hash (starts with 'video-') from a prior call to get_best_video_source. Provide with 'time' to modify a single frame, or with 'startTime' and 'endTime' to modify a video clip.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      },
                      "time": {
                        "description": "Timestamp (HH:MM:SS) of the scene frame to modify when starting from a single frame. Required if modifying a frame via videoSourceHash.",
                        "type": "string"
                      },
                      "startTime": {
                        "description": "Start timestamp (HH:MM:SS) of the scene clip to modify when transforming a video clip. Required if modifying a video clip via videoSourceHash.",
                        "type": "string"
                      },
                      "endTime": {
                        "description": "End timestamp (HH:MM:SS) of the scene clip to modify when transforming a video clip. Required if modifying a video clip via videoSourceHash.",
                        "type": "string"
                      },
                      "imageUrl": {
                        "description": "Direct URL of a find-scene movie frame to modify. Must be an authentic find-scene URL (e.g. from https://api.find-scene.com/s/...). External uploads are not supported.",
                        "type": "string",
                        "format": "uri"
                      },
                      "videoUrl": {
                        "description": "Direct URL of a find-scene movie video clip to modify. Must be an authentic find-scene URL (e.g. from https://api.find-scene.com/s/...). External uploads are not supported.",
                        "type": "string",
                        "format": "uri"
                      },
                      "prompt": {
                        "description": "Detailed description of the visual scene, actions, or transformations to generate (e.g. 'Keanu Reeves raises his open hand as a shiny red apple materializes and floats into his palm').",
                        "type": "string"
                      },
                      "dialogue": {
                        "description": "Optional dialogue for the character to speak with lip sync (e.g. \"You're saying I can do anything the fuck I want with any scene?\").",
                        "type": "string"
                      },
                      "duration": {
                        "description": "Duration of generated video in seconds (5-15, default 5).",
                        "default": 5,
                        "type": "integer",
                        "minimum": 5,
                        "maximum": 15
                      },
                      "resolution": {
                        "description": "Resolution of generated video ('480P' or '768P', default '768P').",
                        "default": "768P",
                        "type": "string",
                        "enum": [
                          "480P",
                          "768P"
                        ]
                      }
                    },
                    "required": [
                      "prompt"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/redub_scene": {
      "post": {
        "operationId": "redub_scene",
        "summary": "Redub or parody a multi-shot movie/TV scene (up to 60s) with new dialogue, voice cloning, background score preservation, selective on-screen lip-sync, and optional burned-in subtitles (supports English, Hebrew, Spanish, and 30+ languages, including RTL captions). Available ONLY for paying Pro users. Preserves 100% of the original 1080p cinematography, cuts, background music/SFX, and straight-man reaction lines while lip-syncing ONLY shots where the speaking character's mouth is visible. Only authentic find-scene movie/TV scenes (videoSourceHash with startTime + endTime, or authentic find-scene videoUrl) are supported. SCRIPT APPROVAL REQUIRED: Before calling redub_scene, ALWAYS draft the proposed speaker-by-speaker script (matched to the scene's speaker turns and time range) with the estimated credit cost and ask the user to approve it first — NEVER launch redub_scene unapproved on a first turn when the user only gave a topic, concept, or link, and NEVER call redub_scene again while another redub is already running in the background. Costs 1 credit per second of scene duration plus 3 credits per second of on-screen lip-synced face shots. Always state the estimated credit cost to the user. The result will be automatically delivered when complete — do not poll or check status.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "videoSourceHash": {
                        "description": "The video source hash (starts with 'video-') from a prior call to get_best_video_source. Provide together with 'startTime' and 'endTime'.",
                        "type": "string",
                        "pattern": "^video-[0-9a-fA-F]{10}$"
                      },
                      "startTime": {
                        "description": "Start timestamp (HH:MM:SS) of the scene range to redub (up to 60s). Required when providing videoSourceHash.",
                        "type": "string"
                      },
                      "endTime": {
                        "description": "End timestamp (HH:MM:SS) of the scene range to redub (up to 60s). Required when providing videoSourceHash.",
                        "type": "string"
                      },
                      "videoUrl": {
                        "description": "Direct URL of a previously downloaded authentic find-scene movie clip (e.g. from https://api.find-scene.com/s/...). External uploads are not supported.",
                        "type": "string",
                        "format": "uri"
                      },
                      "instructions": {
                        "description": "Creative brief or dialogue rewrite instructions (e.g. 'Rewrite the stillsuit explanation as a funny deadpan Burning Man survival guide' or 'Make a funny Hebrew version about Midburn').",
                        "type": "string"
                      },
                      "language": {
                        "description": "Optional target language code or name for the dubbed speech and captions (e.g. 'en', 'he', 'es', 'fr'). Defaults to original scene language or inferred from instructions.",
                        "type": "string"
                      },
                      "burnSubtitles": {
                        "description": "Whether to burn synchronized subtitles of the rewritten dialogue into the output clip (default true).",
                        "default": true,
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "instructions"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "operationId": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "operationId"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/is_movie_name": {
      "post": {
        "operationId": "is_movie_name",
        "summary": "Check if the title is a movie name",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "title"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "isMovieName": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "isMovieName"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/quote_to_movie": {
      "post": {
        "operationId": "quote_to_movie",
        "summary": "Identify the movie or TV show from a spoken dialogue quote (pass actual dialogue lines, not casual chat messages).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "quote": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "quote"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "candidates": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "candidates"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/find_episode_by_phrase": {
      "post": {
        "operationId": "find_episode_by_phrase",
        "summary": "Find a series episode by a phrase. This is not for movies, but tv shows.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "The movie or TV show title",
                        "type": "string"
                      },
                      "imdb": {
                        "type": "string"
                      },
                      "season": {
                        "type": "number"
                      },
                      "episode": {
                        "type": "number"
                      },
                      "year": {
                        "type": "number"
                      },
                      "seasonEnd": {
                        "type": "number"
                      },
                      "episodeEnd": {
                        "type": "number"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code, e.g. \"en\", \"pt-br\", \"uk\". Country codes, 3-letter codes and language names are normalized (\"ua\"/\"ukrainian\" -> \"uk\"). Only specify when the requested audio is a translation/dub different from the production original language; for native/original audio leave this empty (e.g. omit for Hungarian movies or original anime audio).",
                        "type": "string"
                      },
                      "isSeries": {
                        "type": "boolean"
                      },
                      "aliases": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "phrase": {
                        "type": "string"
                      },
                      "limit": {
                        "description": "Maximum number of matching episodes to return (default 5).",
                        "default": 5,
                        "type": "number"
                      },
                      "language": {
                        "description": "Optional ISO 639-1 subtitle language code, e.g. \"en\", \"da\", \"es\", \"pt-br\", \"uk\".",
                        "type": "string"
                      }
                    },
                    "required": [
                      "title",
                      "phrase"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "episodes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "name": {
                                "type": "string"
                              },
                              "season": {
                                "type": "number"
                              },
                              "episode": {
                                "type": "number"
                              },
                              "context": {
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              }
                            }
                          }
                        }
                      },
                      "required": [
                        "episodes"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/query_imdb": {
      "post": {
        "operationId": "query_imdb",
        "summary": "Get movie metadata from IMDB (runtime, cast, details) by title or imdb ID. Do NOT call this just to get an IMDb ID or year before calling get_best_video_source — get_best_video_source resolves IMDb IDs and years automatically from the title.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "The movie or TV show title. Optional when imdb is provided.",
                        "type": "string"
                      },
                      "imdb": {
                        "description": "The IMDB id (e.g. tt0133093). Optional when title is provided.",
                        "type": "string"
                      },
                      "season": {
                        "type": "number"
                      },
                      "episode": {
                        "type": "number"
                      },
                      "year": {
                        "type": "number"
                      },
                      "seasonEnd": {
                        "type": "number"
                      },
                      "episodeEnd": {
                        "type": "number"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code, e.g. \"en\", \"pt-br\", \"uk\". Country codes, 3-letter codes and language names are normalized (\"ua\"/\"ukrainian\" -> \"uk\"). Only specify when the requested audio is a translation/dub different from the production original language; for native/original audio leave this empty (e.g. omit for Hungarian movies or original anime audio).",
                        "type": "string"
                      },
                      "isSeries": {
                        "type": "boolean"
                      },
                      "aliases": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string"
                        },
                        "imdb": {
                          "type": "string"
                        },
                        "year": {
                          "type": "number"
                        },
                        "season": {
                          "type": "number"
                        },
                        "episode": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "name"
                      ],
                      "additionalProperties": true
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/popular_quotes_from_title": {
      "post": {
        "operationId": "popular_quotes_from_title",
        "summary": "Get popular quotes from a movie or TV show title (title-level only — does not filter by season or episode).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "The movie or TV show title.",
                        "type": "string"
                      },
                      "imdb": {
                        "description": "Optional IMDb ID (e.g. tt0133093) if already known.",
                        "type": "string"
                      },
                      "year": {
                        "description": "Optional release year if known.",
                        "type": "number"
                      },
                      "limit": {
                        "description": "Maximum number of popular quotes to return (default 5).",
                        "default": 5,
                        "type": "number"
                      }
                    },
                    "required": [
                      "title"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "quotes": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "quotes"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/find_by_scene_description": {
      "post": {
        "operationId": "find_by_scene_description",
        "summary": "Search scene by non dialog description.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "Exact movie or TV show title only (no year, quality, or actors).",
                        "type": "string"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code (\"en\", \"es\", \"pt-br\", \"ru\", \"uk\", \"ja\", \"ta\", \"te\"). Only specify when the requested audio is a translation/dub different from the production original language (omit for native audio). Pass any localized release title in aliases in the same call; if no dubbed source exists, original-audio fallback sources are returned automatically unless fallbackToOriginalAudio is false.",
                        "type": "string"
                      },
                      "year": {
                        "description": "Release year if known.",
                        "type": "number"
                      },
                      "isSeries": {
                        "description": "True for TV series (requires season and episode; inferred if provided).",
                        "type": "boolean"
                      },
                      "season": {
                        "description": "Optional TV season number to narrow visual search to a specific episode (consistent with get_best_video_source).",
                        "type": "number"
                      },
                      "episode": {
                        "description": "Optional TV episode number to narrow visual search to a specific episode (consistent with get_best_video_source).",
                        "type": "number"
                      },
                      "imdb": {
                        "description": "Optional IMDb ID (e.g. tt0133093) if already known; never guess.",
                        "type": "string"
                      },
                      "aliases": {
                        "description": "Optional alternative/localized titles (automatically searched alongside title and imdb in the same call — never retry separately with an alias you already passed).",
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "animated": {
                        "description": "Optional filter: set to true to search only animated cartoons/anime, or false for live-action only.",
                        "type": "boolean"
                      },
                      "query": {
                        "description": "Visual description of the action, setting, or objects in the scene (e.g. 'man running through rain in a dark alley'). Do NOT pass movie/TV titles, dialogue, or bare character/person names alone.",
                        "type": "string"
                      },
                      "nResults": {
                        "description": "Maximum number of results to return. Defaults to 5.",
                        "default": 5,
                        "type": "number"
                      },
                      "nSkip": {
                        "default": 0,
                        "description": "skip this amount of results, e.g. if user requested the next result, or another one.",
                        "type": "number"
                      },
                      "scoreThreshold": {
                        "description": "Optional minimum visual similarity score (0-1). Usually omit — visual embedding scores typically range 0.15-0.30, so passing >= 0.3 often filters out all valid matches.",
                        "type": "number"
                      }
                    },
                    "required": [
                      "query"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "results": {
                              "type": "array",
                              "items": {
                                "$ref": "#/components/schemas/SceneSearchResult"
                              }
                            },
                            "warning": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "results"
                          ]
                        },
                        {
                          "type": "object",
                          "properties": {
                            "error": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "error"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/request_indexing_for_scene_description": {
      "post": {
        "operationId": "request_indexing_for_scene_description",
        "summary": "Request indexing of a video. If it's a series we need to know the season and episode. Do NOT call this if get_best_video_source already returned \"No video sources found.\" for the same video.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "title": {
                        "description": "The movie or TV show title",
                        "type": "string"
                      },
                      "imdb": {
                        "type": "string"
                      },
                      "season": {
                        "type": "number"
                      },
                      "episode": {
                        "type": "number"
                      },
                      "year": {
                        "type": "number"
                      },
                      "seasonEnd": {
                        "type": "number"
                      },
                      "episodeEnd": {
                        "type": "number"
                      },
                      "dubbed": {
                        "description": "Canonical dubbing language code, e.g. \"en\", \"pt-br\", \"uk\". Country codes, 3-letter codes and language names are normalized (\"ua\"/\"ukrainian\" -> \"uk\"). Only specify when the requested audio is a translation/dub different from the production original language; for native/original audio leave this empty (e.g. omit for Hungarian movies or original anime audio).",
                        "type": "string"
                      },
                      "isSeries": {
                        "type": "boolean"
                      },
                      "aliases": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "title"
                    ]
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "requested": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "requested"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/check_quota": {
      "post": {
        "operationId": "check_quota",
        "summary": "Check how many search credits the current user has remaining. Paid subscriptions replenish on a rolling 30-day window (one-time credit packs and new free starter credits do not replenish). If nextCreditReturnMs is non-null and the user is low on credits, tell them when their next credit returns; otherwise mention grabbing a $5 one-time 25-credit pack or Monthly Pro.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {}
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "creditsRemaining": {
                          "type": "number"
                        },
                        "nextCreditReturnMs": {
                          "type": "number",
                          "nullable": true
                        }
                      },
                      "required": [
                        "creditsRemaining",
                        "nextCreditReturnMs"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/generate_stripe_checkout_link": {
      "post": {
        "operationId": "generate_stripe_checkout_link",
        "summary": "Generate a Stripe checkout link for the user to upgrade to Pro or buy a one-time pay-as-you-go credit pack. Optional 'tier' parameter selects between one-time packs ('pack_25_credits' for $5 / 25 never-expiring credits, 'pack_100_credits' for $15 / 100 never-expiring credits) or monthly subscriptions ('50_credits', '150_credits', '500_credits').",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {
                      "tier": {
                        "description": "The desired subscription tier or one-time credit pack to purchase. Defaults to '50_credits' ($5/mo, 50 credits, cancel anytime); use 'pack_25_credits' or 'pack_100_credits' for one-time non-expiring packs.",
                        "type": "string",
                        "enum": [
                          "pack_25_credits",
                          "pack_100_credits",
                          "50_credits",
                          "150_credits",
                          "500_credits"
                        ]
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/generate_stripe_portal_link": {
      "post": {
        "operationId": "generate_stripe_portal_link",
        "summary": "Generate a Stripe customer portal link for the user to manage or cancel their subscription.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "allOf": [
                  {
                    "$ref": "#/components/schemas/TokenField"
                  },
                  {
                    "type": "object",
                    "properties": {}
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {
                      "type": "object",
                      "properties": {
                        "url": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "url"
                      ]
                    }
                  },
                  "required": [
                    "result"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid parameters"
          },
          "401": {
            "description": "Unauthorized"
          },
          "500": {
            "description": "Internal server error"
          }
        }
      }
    },
    "/api/operation/{id}": {
      "get": {
        "operationId": "get_operation_status",
        "summary": "Poll the status of an async operation (returned by download_by_time or extract_frame). Pass your API token via Authorization: Bearer <token>, X-API-Token header, or _token query param.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "_token",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Operation status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": [
                        "in_progress",
                        "completed",
                        "failed",
                        "cancelled"
                      ]
                    },
                    "progress": {
                      "type": "number"
                    },
                    "result": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string",
                      "description": "Signed URL for completed downloads"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "404": {
            "description": "Operation not found"
          }
        }
      }
    }
  }
}