{"openapi":"3.1.0","info":{"title":"EntertainmentHub API","version":"2.1.0","summary":"Unified streaming-source finder.","description":"A unified streaming-source API.\n\nSources are anonymised as **source_one … source_six**. Discovery feeds\n(Trending / Top Rated / Recent / Most Watched) and search both yield *titles*;\n`POST /api/aggregate` resolves a title across every enabled source into audio\noptions + seasons, and `/api/{source}/streams` + `/resolve` return final,\ndirectly-playable URLs (with the HTTP headers they require).\n\n**Typical flow**\n\n1. `GET /api/search?q=Dune` (or `GET /api/discover/trending`) → title cards\n2. `POST /api/aggregate {title, year, media_type}` → seasons + `audio_options[]`\n3. `GET /api/{source}/streams?id=<subject_id>&season=&episode=` → releases\n4. `POST /api/{source}/resolve {release}` → final URL(s) + headers\n\n**Errors** are always JSON: `{\"detail\": \"...\"}` (validation errors: `detail` is a list).\n\n**Authentication** is optional and set by the server operator:\n`X-API-Key` for all `/api/*` calls when the server has API keys configured,\nand `X-Admin-Key` for endpoints that change server-wide state.\n","contact":{"name":"API support"},"license":{"name":"Proprietary"}},"tags":[{"name":"meta","description":"Health and service information."},{"name":"sources","description":"The anonymised sources and their enable/disable toggles."},{"name":"discover","description":"Curated discovery feeds (title cards)."},{"name":"search","description":"Cross-source search, aggregation and title details."},{"name":"streams","description":"Releases, final playable URLs and subtitles for one pinned source."},{"name":"addons","description":"Stremio addons powering source_six."}],"security":[[],{"ApiKeyHeader":[]},{"BearerKey":[]}],"paths":{"/api/health":{"get":{"tags":["meta"],"summary":"Liveness check","description":"Never requires an API key and is not rate limited — use it for uptime monitors.","operationId":"health","security":[[]],"responses":{"200":{"description":"Service is up.","content":{"application/json":{"schema":{"type":"object","required":["status","version"],"properties":{"status":{"type":"string","example":"ok"},"version":{"type":"string","example":"2.1.0"}}}}}}}}},"/api/sources":{"get":{"tags":["sources"],"summary":"List sources","operationId":"listSources","responses":{"200":{"description":"Every source, in stable order.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SourceInfo"}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}},"/api/sources/toggle":{"post":{"tags":["sources"],"summary":"Enable or disable a source (admin)","operationId":"toggleSource","security":[{"AdminKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceToggleRequest"},"example":{"alias":"source_four","enabled":true}}}},"responses":{"200":{"description":"All sources after the change.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SourceInfo"}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/discover":{"get":{"tags":["discover"],"summary":"List discovery presets","operationId":"listPresets","responses":{"200":{"description":"Available presets.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Preset"}}}}}}}},"/api/discover/{preset}":{"get":{"tags":["discover"],"summary":"Discovery feed","description":"Movies and series interleaved. Cached server-side (default 15 minutes).","operationId":"discoverFeed","parameters":[{"name":"preset","in":"path","required":true,"schema":{"type":"string","enum":["trending","top_rated_all","top_rated_recent","most_watched"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":40,"minimum":0,"maximum":200}}],"responses":{"200":{"description":"Title cards.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TitleCard"}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/search":{"get":{"tags":["search"],"summary":"Aggregated search","description":"Searches every **enabled** source in parallel and merges the results.\nTitles carried by more sources come first. Cached server-side (default 5 minutes).\n","operationId":"search","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1},"example":"inception"},{"name":"page","in":"query","schema":{"type":"integer","default":1,"minimum":1,"maximum":100}}],"responses":{"200":{"description":"Merged title cards.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TitleCard"}}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/aggregate":{"post":{"tags":["search"],"summary":"Resolve a title across all enabled sources","description":"Finds the title on every enabled source (in parallel) and returns the union\nof seasons plus one **audio option** per source / language version. Each audio\noption pins a `source` and `subject_id` for `/api/{source}/streams`.\nTypically takes 5–20 s; cached server-side (default 10 minutes).\n","operationId":"aggregate","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateRequest"},"example":{"title":"Inception","year":"2010","media_type":"movie"}}}},"responses":{"200":{"description":"Seasons and audio options.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AggregateResult"}}}},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/meta":{"get":{"tags":["search"],"summary":"Title details","description":"Overview, rating, genres, cast, backdrop and logo — by IMDb id when given, else best match on title + year.","operationId":"meta","parameters":[{"name":"title","in":"query","required":true,"schema":{"type":"string","minLength":1},"example":"Inception"},{"name":"year","in":"query","schema":{"type":"string"},"example":"2010"},{"name":"type","in":"query","schema":{"type":"string","enum":["movie","series"]}},{"name":"imdb_id","in":"query","schema":{"type":"string"},"example":"tt1375666"}],"responses":{"200":{"description":"Title card with full details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TitleCard"}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"}}}},"/api/{source}/streams":{"get":{"tags":["streams"],"summary":"Releases for one source + subject","description":"Use `season=0&episode=0` for movies. URLs may be time-limited (signed) — fetch\nstreams right before playback; they are never cached.\n","operationId":"streams","parameters":[{"$ref":"#/components/parameters/Source"},{"name":"id","in":"query","required":true,"description":"The `subject_id` from an audio option.","schema":{"type":"string","minLength":1}},{"name":"season","in":"query","schema":{"type":"integer","default":0,"minimum":0}},{"name":"episode","in":"query","schema":{"type":"integer","default":0,"minimum":0}}],"responses":{"200":{"description":"Releases, best first.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Release"}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"502":{"$ref":"#/components/responses/BadGateway"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/api/{source}/resolve":{"post":{"tags":["streams"],"summary":"Resolve a release to final playable URL(s)","description":"Post back one release object exactly as `/streams` returned it. For sources with\n`needs_resolve: true` the server walks the mirror chain and verifies the links\n(can take 5–30 s); for others the mirrors are returned as-is.\n","operationId":"resolve","parameters":[{"$ref":"#/components/parameters/Source"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveRequest"}}}},"responses":{"200":{"description":"Playable candidates, best first. Send the listed headers when playing.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ResolvedSource"}}}}},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/ValidationError"},"502":{"$ref":"#/components/responses/BadGateway"}}}},"/api/{source}/subtitles":{"get":{"tags":["streams"],"summary":"Subtitle tracks","description":"Supported by source_one; other sources return an empty list.","operationId":"subtitles","parameters":[{"$ref":"#/components/parameters/Source"},{"name":"id","in":"query","required":true,"description":"The subject id.","schema":{"type":"string","minLength":1}},{"name":"resource_id","in":"query","description":"`resource_id` of a release.","schema":{"type":"string","default":""}}],"responses":{"200":{"description":"Subtitle tracks.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SubtitleOption"}}}}},"404":{"$ref":"#/components/responses/NotFound"}}}},"/api/addons":{"get":{"tags":["addons"],"summary":"List installed addons","operationId":"listAddons","responses":{"200":{"description":"Installed addons.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InstalledAddon"}}}}}}},"post":{"tags":["addons"],"summary":"Install an addon (admin)","operationId":"addAddon","security":[{"AdminKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["manifest_url"],"properties":{"manifest_url":{"type":"string","description":"Addon URL; `stremio://` and URLs without `/manifest.json` are accepted."}}},"example":{"manifest_url":"https://example-addon.strem.fun/manifest.json"}}}},"responses":{"200":{"description":"All addons after the change.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InstalledAddon"}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"},"502":{"$ref":"#/components/responses/BadGateway"}}},"delete":{"tags":["addons"],"summary":"Remove an addon (admin)","operationId":"removeAddon","security":[{"AdminKey":[]}],"parameters":[{"name":"manifest_url","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"All addons after the change.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InstalledAddon"}}}}},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/api/addons/toggle":{"post":{"tags":["addons"],"summary":"Enable or disable an addon (admin)","operationId":"toggleAddon","security":[{"AdminKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["manifest_url","enabled"],"properties":{"manifest_url":{"type":"string"},"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"All addons after the change.","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InstalledAddon"}}}}},"403":{"$ref":"#/components/responses/Forbidden"},"422":{"$ref":"#/components/responses/ValidationError"}}}}},"components":{"securitySchemes":{"ApiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key","description":"Required only when the server operator configured API_KEYS."},"BearerKey":{"type":"http","scheme":"bearer","description":"Same API key sent as `Authorization: Bearer <key>`."},"AdminKey":{"type":"apiKey","in":"header","name":"X-Admin-Key","description":"Required for endpoints that change server-wide state."}},"parameters":{"Source":{"name":"source","in":"path","required":true,"description":"Source alias.","schema":{"type":"string","enum":["source_one","source_two","source_three","source_four","source_five","source_six"]}}},"responses":{"NotFound":{"description":"Unknown source, preset or title.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"detail":"Unknown source 'source_ten'"}}}},"Unauthorized":{"description":"Missing or invalid API key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"detail":"Invalid API key"}}}},"Forbidden":{"description":"Missing/invalid admin key, or admin endpoints disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"detail":"A valid X-Admin-Key header is required for this endpoint."}}}},"ValidationError":{"description":"Invalid parameters or body.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"TooManyRequests":{"description":"Rate limit exceeded. See the `Retry-After` header.","headers":{"Retry-After":{"schema":{"type":"integer"},"description":"Seconds until the window resets."}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"BadGateway":{"description":"The source failed to answer (temporary; try another audio option or retry).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"example":{"detail":"No stream sources available"}}}},"Unavailable":{"description":"The source cannot be used right now.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["detail"],"properties":{"detail":{"type":"string"}}},"ValidationError":{"type":"object","required":["detail"],"properties":{"detail":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","example":"missing"},"loc":{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]},"example":["query","q"]},"msg":{"type":"string","example":"Field required"}}}}}},"SourceInfo":{"type":"object","required":["alias","label","enabled","needs_resolve"],"properties":{"alias":{"type":"string","example":"source_one"},"label":{"type":"string","example":"Source One"},"enabled":{"type":"boolean"},"needs_resolve":{"type":"boolean","description":"When true, call `/resolve` to turn a release into a playable URL."}}},"SourceToggleRequest":{"type":"object","required":["alias","enabled"],"properties":{"alias":{"type":"string"},"enabled":{"type":"boolean"}}},"Preset":{"type":"object","properties":{"key":{"type":"string","example":"trending"},"label":{"type":"string","example":"Trending Now"}}},"TitleCard":{"type":"object","required":["title","media_type"],"properties":{"title":{"type":"string"},"year":{"type":["string","null"],"example":"2010"},"media_type":{"type":"string","enum":["movie","series"]},"poster_url":{"type":["string","null"]},"poster_urls":{"type":"array","items":{"type":"string"},"description":"Every poster candidate, best first (fallbacks if one fails to load)."},"imdb_rating":{"type":["string","null"],"example":"8.8"},"overview":{"type":["string","null"]},"source_count":{"type":["integer","null"],"description":"Number of sources carrying this title (search only)."},"backdrop_url":{"type":["string","null"]},"logo_url":{"type":["string","null"]},"genres":{"type":"array","items":{"type":"string"}},"runtime":{"type":["string","null"],"example":"148 min"},"cast":{"type":"array","items":{"type":"string"}}}},"Episode":{"type":"object","properties":{"season":{"type":"integer"},"number":{"type":"integer"},"title":{"type":["string","null"]},"overview":{"type":["string","null"]}}},"Season":{"type":"object","properties":{"number":{"type":"integer"},"episodes":{"type":"array","items":{"$ref":"#/components/schemas/Episode"}}}},"AudioOption":{"type":"object","properties":{"source":{"type":"string","example":"source_one"},"source_label":{"type":"string","example":"Source One"},"subject_id":{"type":"string","description":"Pass as `id` to `/api/{source}/streams`."},"language":{"type":"string","example":"Original Audio"},"label":{"type":"string","example":"Source One · Original Audio"},"needs_resolve":{"type":"boolean"}}},"AggregateRequest":{"type":"object","required":["title"],"properties":{"title":{"type":"string","minLength":1},"year":{"type":["string","null"]},"media_type":{"type":["string","null"],"enum":["movie","series",null]}}},"AggregateResult":{"type":"object","properties":{"title":{"type":"string"},"year":{"type":["string","null"]},"media_type":{"type":"string","enum":["movie","series"]},"is_series":{"type":"boolean"},"seasons":{"type":"array","items":{"$ref":"#/components/schemas/Season"}},"audio_options":{"type":"array","items":{"$ref":"#/components/schemas/AudioOption"}},"matched_sources":{"type":"integer"}}},"Header":{"type":"array","description":"[name, value]","prefixItems":[{"type":"string"},{"type":"string"}],"minItems":2,"maxItems":2,"example":["User-Agent","Mozilla/5.0"]},"SourceMirror":{"type":"object","required":["label","resolver_url"],"properties":{"label":{"type":"string"},"resolver_url":{"type":"string"},"headers":{"type":"array","items":{"$ref":"#/components/schemas/Header"}},"direct_file":{"type":"boolean"}}},"Release":{"type":"object","required":["source","filename"],"properties":{"source":{"type":"string"},"filename":{"type":"string"},"quality":{"type":["string","null"],"example":"1080p"},"codec":{"type":["string","null"],"example":"HEVC"},"language":{"type":["string","null"]},"size_bytes":{"type":["integer","null"]},"season":{"type":["integer","null"]},"episode":{"type":["integer","null"]},"mirrors":{"type":"array","items":{"$ref":"#/components/schemas/SourceMirror"}},"resource_id":{"type":["string","null"]}}},"ResolveRequest":{"type":"object","required":["release"],"properties":{"release":{"$ref":"#/components/schemas/Release"}}},"ResolvedSource":{"type":"object","properties":{"url":{"type":"string"},"label":{"type":"string"},"headers":{"type":"array","items":{"$ref":"#/components/schemas/Header"}}}},"SubtitleOption":{"type":"object","properties":{"name":{"type":"string","example":"English"},"url":{"type":"string"}}},"InstalledAddon":{"type":"object","properties":{"manifest_url":{"type":"string"},"name":{"type":"string"},"enabled":{"type":"boolean"},"provides_catalog":{"type":"boolean"},"provides_meta":{"type":"boolean"},"provides_stream":{"type":"boolean"},"types":{"type":"array","items":{"type":"string"}},"id_prefixes":{"type":"array","items":{"type":"string"}}}}}},"servers":[{"url":"https://softmovies.madisoftworks.com","description":"This server"}]}