docs(rest-api): build the download request table from the OpenAPI yaml

This commit is contained in:
imSp4rky
2026-12-04 17:43:27 -07:00
parent 7a40b7739b
commit 8d3ae1151e
7 changed files with 397 additions and 222 deletions
+2
View File
@@ -7,12 +7,14 @@ on:
- "docs/**"
- "overrides/**"
- "mkdocs.yml"
- "unshackle/core/api/routes.py"
- ".github/workflows/docs.yml"
pull_request:
paths:
- "docs/**"
- "overrides/**"
- "mkdocs.yml"
- "unshackle/core/api/routes.py"
- ".github/workflows/docs.yml"
workflow_dispatch:
+2 -61
View File
@@ -437,68 +437,9 @@ Make a download job. It requires `service` and `title_id`. Every other field is
}
```
**Common parameters** (all optional). These mirror the [`dl` command](../../guide/downloading.md) flags:
**Request body.** Every field except `service` and `title_id` is optional. The `dl` fields mirror the flags of the [`dl` command](../../guide/downloading.md). This table comes from the OpenAPI description that `/api/docs/` of a running server also shows.
| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `profile` | string | `null` | Credential/cookie profile. |
| `quality` | int[] | `[]` | Target resolution(s); best available if empty, or the lowest with `worst`. |
| `vcodec` | string/string[] | `[]` | Video codec filter. |
| `acodec` | string/string[] | `[]` | Audio codec filter. |
| `vbitrate` / `abitrate` | int | `null` | Video / audio bitrate in kbps (positive). |
| `vbitrate_range` / `abitrate_range` | string | `null` | `"MIN-MAX"` bitrate window. |
| `range` | string[] | `["SDR"]` | Dynamic range(s). |
| `channels` | number | `null` | Audio channel layout. |
| `no_atmos` | boolean | `false` | Exclude Atmos tracks. |
| `wanted` | string / string[] | `[]` | Episode/season selectors, as a list or as one comma-separated string. Accepts the part form, `"S01E01.2"`, and the air-date form, `"2026-08-11"` or `"2026-08-01:2026-08-31"`. For a music release, a selector is a number of the track list, `"1-5"` or `"1,3,7"`, or `"{disc}x{track}"` such as `"2x3"`. |
| `latest_episode` | boolean | `false` | Only the newest episode. |
| `latest_episodes` | integer | `null` | Only the N newest episodes. A positive integer. When set, it overrides `latest_episode`. |
| `max_downloads` | integer | `null` | Stop the job after N titles have downloaded. A positive integer. A title in `skipped_titles` or `already_present` does not count. |
| `lang` / `v_lang` / `a_lang` / `s_lang` | string[] | `["orig"]` / `[]` / `[]` / `["all"]` | Language filters. A missing `s_lang` language gives a warning and the job continues. |
| `require_audio` | string[] | `[]` | Audio languages that must exist. The job fails if one is missing, even with `best_available`, or skips the title with `skip_missing`. |
| `require_video` | string[] | `[]` | Video languages that must exist. The job fails if one is missing, even with `best_available`, or skips the title with `skip_missing`. |
| `require_subs` | string[] | `[]` | Subtitle languages that must exist. The job fails if one is missing, or skips the title with `skip_missing`. `s_lang` still decides what to keep. |
| `skip_missing` | boolean | `false` | Skip a title that misses a required language or track, and continue with the next title. The job's `skipped_titles` lists each skip. The job fails when it has one title or skips every title. |
| `skip_existing` | boolean | `false` | Skip variants recorded as completed for this API key, matched after selection by service, title ID, quality, range and codec. Does not verify files on disk or compare audio/subtitle choices. |
| `force` | boolean | `false` | Bypass the completion archive check for this job. Does not change overwrite behaviour. |
| `forced_subs` | boolean | `false` | Include forced subtitles. |
| `forced_subs_only` | boolean | `false` | Download forced subtitles and no other subtitle; implies `forced_subs`. Not valid with `no_subs`, `video_only`, `audio_only` or `chapters_only`. |
| `forced_s_lang` | string[] | `[]` | Forced subtitle language(s); implies `forced_subs`. |
| `exact_lang` | boolean | `false` | A language tag without a region never falls back to another variant. A tag with a region is always exact. |
| `sub_format` | string | `null` | Output subtitle format. |
| `sub_font` | string | `null` | Font for subtitles converted to ASS; implies `sub_format` ASS. With another `sub_format` the request returns `400`. |
| `video_only` / `audio_only` / `subs_only` / `chapters_only` | boolean | `false` | Track-type restriction. Two or more combine, as on the CLI. |
| `no_subs` / `no_audio` / `no_chapters` / `no_video` / `no_attachments` | boolean | `false` | Skip a track type. |
| `skip_subtitle_errors` | boolean | `false` | Skip a subtitle that fails to download and keep the other tracks. |
| `audio_description` | boolean | `false` | Download audio description. |
| `audio_description_only` | boolean | `false` | Download audio description and no standard audio. Not valid with `no_audio`, `video_only`, `subs_only` or `chapters_only`. |
| `slow` | boolean/string/array | `null` | Randomized delay between downloads: `true` (60-120 seconds), `"MIN-MAX"`, or `[MIN, MAX]`. |
| `split_audio` | boolean | `null` | Separate files per audio codec. |
| `skip_dl` | boolean | `false` | Only fetch keys, do not download. |
| `all_drm` | boolean | `false` | License each track with both Widevine and PlayReady. Needs a CDM for each DRM system. Key vaults are read first; `cdm_only: true` sends a challenge for each system. The server refuses it with `cdm`, which selects one device. |
| `export` | boolean | `false` | Export manifest/keys/subs to JSON. |
| `cdm_only` | boolean | `null` | Force CDM-only (`true`) or vault-only (`false`) key retrieval. With `remote`, `true` licenses every track with the CDM of this server and uses no CDM or vault of the remote server. |
| `proxy` / `no_proxy` / `no_proxy_download` / `proxy_download` | string / bool / bool / string | `null` / `false` / `false` / `null` | Proxy controls. `proxy` and `proxy_download` must be full proxy URIs on a public host unless the API key has `server_proxy`. A Control D resolver, `controld://<resolver>@dns.controld.com`, counts as a full proxy URI: the server runs a forwarder for it. |
| `no_folder` / `no_source` / `no_mux` | boolean | `false` | Output/mux controls. |
| `sample` | boolean/string | `null` | Download a short sample and write it with a `SAMPLE` tag on the filename in a `Sample` folder inside the output folder. `true` is 60 seconds from 2 minutes in; `"0-60"` is a window in seconds. |
| `include_sample` | boolean | `false` | Download the full title, then also cut a 60 second sample from each muxed file into a `Sample` folder next to it. |
| `workers` | int | `null` | Threads per track. |
| `adaptive_workers` | boolean | `false` | Scale segment workers to measured CDN throughput, up to the `workers` cap. |
| `download_processes` | int | `1` | Split a track's segments across this many processes. Only engages for large batches. |
| `continue_downloads` | boolean | `false` | Keep the completed segment files across runs and resume a download that failed before. |
| `downloads` | int | `1` | Concurrent tracks. |
| `worst` | boolean | `false` | Pick the lowest-bitrate video at each resolution in `quality`, or at the lowest resolution if `quality` is empty. |
| `best_available` | boolean | `false` | Fall back to best available. With `all_drm`, a DRM system that does not license is a warning. |
| `generate_dv` | boolean | `false` | With `HYBRID` in `range`, make Dolby Vision from the HDR10+ metadata or the decoded video when a title has no DV track. With `HDR10` or `HDR10P` in `range` and no `HYBRID`, make it for that base and ignore a DV track. With none of the three in `range`, the field has no effect. |
| `repack` | boolean | `false` | Add REPACK tag. |
| `tag` | string | `null` | Release group tag. |
| `tmdb_id` / `imdb_id` / `tvdb_id` / `anilist_id` | - | `null` | External ID overrides. Each resolves its metadata directly instead of by a title search, and is used for tagging. Set `enrich` to also take the title, year and original language. Give at most one of `tmdb_id`, `imdb_id` and `tvdb_id`, since unshackle resolves the others from it. Sending two returns `400`. `anilist_id` still combines with one of them. `tmdb_id` and `tvdb_id` must be positive integers, `imdb_id` must look like `tt1375666`, and `anilist_id` must be a positive integer or a string like `mal:12345`, or the request returns `400`. An ID whose provider is unconfigured, such as `tmdb_id` with no `tmdb_api_key`, returns `400`. `anilist_id` needs no API key. |
| `tvdb_order` | `official`, `dvd`, `absolute`, `alternate`, `regional` | `null` | Renumber episodes to a TVDB season order. Falls back to the `tvdb_order` config option. |
| `continuous_episodes` | boolean | `false` | Number each season on from the season before it, so season two starts at episode 5 after four episodes. Season 0 and episode 0 keep their numbers. `wanted` selects by the new numbers, but the list endpoints show the numbers of the service. |
| `enrich` | boolean | `false` | Overwrite title, year and original language with the external source's. Needs one of `tmdb_id`, `imdb_id`, `tvdb_id` or `anilist_id`. Without one the request returns `400`. |
| `daily` | boolean | `false` | Treat the title as daily/date-based content and fill missing episode air dates from TVDB. The fill needs `enrich` and a TVDB ID. An air date the service already set is kept. |
| `output_dir` | string | `null` | Output directory, relative to the server's downloads directory. The server rejects a path that resolves outside it with `400`. |
| `no_cache` / `reset_cache` | boolean | `false` | Title cache controls. |
<!-- download-fields -->
**Validation.** Invalid values return `400 INVALID_PARAMETERS`. `vcodec`, `acodec` and `sub_format` take the same spellings as the CLI options of the same name (`unshackle dl --help` prints each list). The API and the CLI read one list, so they cannot disagree. `range` must be one of SDR/HDR10/HDR10P/VIVID/DV/HLG/HYBRID, and `HDR10+` and `HDR Vivid` are also valid. The bitrate, download worker, and download counts must be positive integers. You cannot combine `no_subs` with `subs_only`, or `no_audio` with `audio_only`. The server runs the same option checks as `unshackle dl`, so a request that `dl` would refuse returns `400` when you submit it, and the message names the `dl` option. The language fields (`lang`, `v_lang`, `a_lang`, `s_lang`, `forced_s_lang` and the `require_*` fields) must be arrays of strings: a single string such as `"en"` returns `400`. The server checks every other field with the type of its `dl` option. A `null` or an empty string gets the default from the table.
+3 -18
View File
@@ -224,26 +224,11 @@ JOB=$(curl -s -X POST "$BASE/api/download" \
| python -c "import sys, json; print(json.load(sys.stdin)['job_id'])")
```
### Frequently used download fields
### Download fields
The request body accepts the full download parameter set. A few of the most useful:
The request body takes every `dl` option. The [request body table](endpoints.md#post-apidownload) gives the type, default and meaning of each field.
| Field | Default | Meaning |
| --- | --- | --- |
| `service` | - | Service tag (required) |
| `title_id` | - | Title identifier (required) |
| `profile` | `null` | Named credential/cookie profile to use |
| `quality` | `[]` | Resolution(s), e.g. `[1080]`; empty means best available |
| `vcodec` | `[]` | Video codec, e.g. `"H265"` |
| `acodec` | `[]` | Audio codec, e.g. `"EC3"` |
| `range` | `["SDR"]` | Dynamic range: `SDR`, `HDR10`, `HDR10+`, `VIVID`, `DV`, `HLG`, `HYBRID` |
| `wanted` | `[]` | Episodes to fetch, e.g. `["S01E01"]`, or music tracks, e.g. `["1-5"]`. Empty means all |
| `lang` | `["orig"]` | Video/audio language(s) |
| `s_lang` | `["all"]` | Subtitle language(s) |
| `downloads` | `1` | Number of tracks to download concurrently |
| `proxy` | `null` | Proxy URI or country code |
Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both `no_subs` and `subs_only`) come back as `400` with error code `INVALID_PARAMETERS`. See the full reference on the [download reference page](endpoints.md) for every accepted field.
Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both `no_subs` and `subs_only`) come back as `400` with error code `INVALID_PARAMETERS`.
!!! note "Gated fields"
The server refuses a per-request CDM (`cdm`) or inline credentials (`credential` / `credentials`) with `403 FORBIDDEN`, unless the server operator has explicitly opted in with `serve.cdm_overrides` and `serve.allow_job_credentials`. Both are off by default.
+51
View File
@@ -0,0 +1,51 @@
"""MkDocs hook that renders the POST /api/download request body table from the OpenAPI block in routes.py.
It reads routes.py with ast and never imports unshackle, because the docs build installs only the docs requirements.
"""
import ast
import json
from pathlib import Path
from typing import Any
import yaml
MARKER = "<!-- download-fields -->"
PAGE = "dev/rest-api/endpoints.md"
ROUTES = Path(__file__).parents[2] / "unshackle/core/api/routes.py"
def request_schema() -> dict[str, Any]:
"""The JSON schema of the POST /api/download request body, read from the docstring of ``download`` after its last
``---``, as aiohttp_swagger3 reads it."""
tree = ast.parse(ROUTES.read_text(encoding="utf-8"))
func = next(node for node in tree.body if isinstance(node, ast.AsyncFunctionDef) and node.name == "download")
spec = yaml.safe_load(str(ast.get_docstring(func)).rsplit("---", 1)[-1])
return spec["requestBody"]["content"]["application/json"]["schema"]
def type_text(schema: dict[str, Any]) -> str:
if "oneOf" in schema:
return " / ".join(type_text(option) for option in schema["oneOf"])
if "enum" in schema:
return ", ".join(f"`{value}`" for value in schema["enum"])
if schema["type"] == "array":
return type_text(schema["items"]) + "[]"
return schema["type"] + (f" ≥ {schema['minimum']}" if "minimum" in schema else "")
def render(schema: dict[str, Any]) -> str:
rows = ["| Field | Type | Default | Description |", "| --- | --- | --- | --- |"]
for name, field in schema["properties"].items():
default = "required" if name in schema.get("required", ()) else f"`{json.dumps(field.get('default'))}`"
description = " ".join(field.get("description", "").split()).replace("|", "\\|")
rows.append(f"| `{name}` | {type_text(field)} | {default} | {description} |")
return "\n".join(rows)
def on_page_markdown(markdown: str, page: Any, **kwargs: Any) -> str:
if MARKER not in markdown:
if page.file.src_uri == PAGE:
raise ValueError(f"{PAGE} has no {MARKER} marker for the download request table")
return markdown
return markdown.replace(MARKER, render(request_schema()))
+6
View File
@@ -9,6 +9,12 @@ extra_css:
exclude_docs: |
reference/configuration.md
hooks/
hooks:
- docs/hooks/download_fields.py
watch:
- unshackle/core/api/routes.py
theme:
name: material
+19 -13
View File
@@ -1,16 +1,14 @@
from __future__ import annotations
import importlib.util
import inspect
import re
from pathlib import Path
import click
import pytest
import yaml
from tests.admission import refusal
from unshackle.commands.dl import dl
from unshackle.core.api import routes
from unshackle.core.dl_options import (
DEFAULT_DOWNLOAD_PARAMS,
DL_OPTION_ALIASES,
@@ -31,20 +29,28 @@ def test_the_table_decides_every_dl_option():
assert set(cast_dl_params(dl.cli, {})) == cli_names - CLI_ONLY
def test_the_openapi_yaml_names_each_api_dl_option_and_no_other():
"""The download request body documents every dl option the API takes, beside its own request keys."""
schema = yaml.safe_load((routes.download.__doc__ or "").split("---", 1)[1])
properties = schema["requestBody"]["content"]["application/json"]["schema"]["properties"]
ROOT = Path(__file__).parents[3]
HOOK_SPEC = importlib.util.spec_from_file_location("download_fields", ROOT / "docs/hooks/download_fields.py")
assert HOOK_SPEC and HOOK_SPEC.loader
download_fields = importlib.util.module_from_spec(HOOK_SPEC)
HOOK_SPEC.loader.exec_module(download_fields)
def test_the_openapi_yaml_documents_each_api_dl_option_with_its_default():
"""The download request body documents every dl option the API takes, with its API default, beside its own
request keys. A missing default reads as null."""
properties = download_fields.request_schema()["properties"]
assert DEFAULT_DOWNLOAD_PARAMS.keys() <= properties.keys()
assert properties.keys() - DEFAULT_DOWNLOAD_PARAMS.keys() == {"service", "title_id", "remote", "client_name", "cdm"}
assert {key: properties[key].get("default") for key in DEFAULT_DOWNLOAD_PARAMS} == DEFAULT_DOWNLOAD_PARAMS
def test_the_endpoint_docs_name_each_api_dl_option():
"""The POST /api/download table of the endpoint reference has a row for every dl option the API takes."""
page = (Path(__file__).parents[3] / "docs/dev/rest-api/endpoints.md").read_text(encoding="utf-8")
section = page.split("### `POST /api/download`", 1)[1].split("\n### ", 1)[0]
rows = [line.split("|")[1] for line in section.splitlines() if line.startswith("| `")]
assert DEFAULT_DOWNLOAD_PARAMS.keys() <= {name for row in rows for name in re.findall(r"`(\w+)`", row)}
def test_the_docs_hook_renders_a_row_for_each_request_field():
"""mkdocs.yml loads the hook, which renders one row for each request body field."""
assert "docs/hooks/download_fields.py" in (ROOT / "mkdocs.yml").read_text(encoding="utf-8")
schema = download_fields.request_schema()
rows = download_fields.render(schema).splitlines()[2:]
assert [row.split("`")[1] for row in rows] == list(schema["properties"])
def test_api_defaults_cast_to_the_dl_defaults():
+314 -130
View File
@@ -969,319 +969,503 @@ async def download(request: web.Request) -> web.Response:
- service
- title_id
properties:
remote:
type: string
description: >
A remote_services server name from GET /api/config. The service runs through that
server (login, titles, tracks, licences); a download still runs on this server.
client_name:
type: string
description: Names this client on the remote server's dashboard, as serve (client_name)
service:
type: string
description: Service tag
description: >-
Service tag.
title_id:
type: string
description: Title identifier
description: >-
Title identifier.
profile:
type: string
description: Profile to use for credentials and cookies (default - None)
description: >-
Profile for credentials and cookies.
quality:
type: array
items:
type: integer
default: []
description: >-
Download resolution(s) (default - best available; lowest with worst). An API key with a
server_cdm_max_height for the service must pass a quality at or under that height.
Resolution(s) to download, such as `[1080]`. An empty list takes the best available, or the lowest
with `worst`. An API key with a `server_cdm_max_height` for the service must send a quality at or
under that height.
vcodec:
oneOf:
- type: string
- type: array
items:
type: string
description: Video codec(s) to download (e.g., "HEVC" or ["AVC", "HEVC"]) - accepts AVC, H.264, H264, HEVC, H.265, H265, VVC, H.266, H266, VC1, VC-1, VP8, VP9, AV1, LCEVC (default - [])
default: []
description: >-
Video codec(s) to download, such as `"HEVC"` or `["AVC", "HEVC"]`. Takes AVC, H.264, H264, HEVC,
H.265, H265, VVC, H.266, H266, VC1, VC-1, VP8, VP9, AV1 and LCEVC.
acodec:
oneOf:
- type: string
- type: array
items:
type: string
description: Audio codec(s) to download (e.g., "AAC" or ["AAC", "EC3"]) - accepts AAC, AC3, DD, EC3, DD+, EAC3, DDP, AC4, AC-4, OPUS, OGG, VORB, VORBIS, DTS, DTSX, DTS-X, DTSHD, DTS-HD, MPEGH, MPEG-H, AV3A, Audio Vivid, ALAC, FLAC, MP3 (default - [])
default: []
description: >-
Audio codec(s) to download, such as `"AAC"` or `["AAC", "EC3"]`. Takes AAC, AC3, DD, EC3, DD+, EAC3,
DDP, AC4, AC-4, OPUS, OGG, VORB, VORBIS, DTS, DTSX, DTS-X, DTSHD, DTS-HD, MPEGH, MPEG-H, AV3A, Audio
Vivid, ALAC, FLAC and MP3.
vbitrate:
type: integer
description: Video bitrate in kbps (default - None)
minimum: 1
description: >-
Video bitrate in kbps.
abitrate:
type: integer
description: Audio bitrate in kbps (default - None)
minimum: 1
description: >-
Audio bitrate in kbps.
vbitrate_range:
type: string
description: >-
Video bitrate range in kbps as "MIN-MAX" (e.g., "6000-7000"). Selects the highest bitrate in the
range. Cannot be used with vbitrate (default - None)
Video bitrate window in kbps as `"MIN-MAX"`, such as `"6000-7000"`. Selects the highest bitrate in
the window. Not valid with `vbitrate`.
abitrate_range:
type: string
description: >-
Audio bitrate range in kbps as "MIN-MAX" (e.g., "128-256"). Selects the highest bitrate in the
range. Cannot be used with abitrate (default - None)
Audio bitrate window in kbps as `"MIN-MAX"`, such as `"128-256"`. Selects the highest bitrate in the
window. Not valid with `abitrate`.
range:
type: array
items:
type: string
default: ["SDR"]
description: >-
Video colour range (SDR, HDR10, HDR10+, VIVID, HLG, DV, HYBRID) (default - ["SDR"]).
An API key with a server_cdm_max_height for the service cannot set HYBRID.
Dynamic range(s) to download: SDR, HLG, HDR10, HDR10P, VIVID, DV or HYBRID, in any case. `HDR10+`
and `HDR Vivid` are also valid. An API key with a `server_cdm_max_height` for the service cannot
send HYBRID.
channels:
type: number
description: Audio channels (e.g., 2.0, 5.1, 7.1) (default - None)
description: >-
Audio channels, a positive number such as 2.0, 5.1 or 7.1. 5.1 also matches a 6.0 layout.
no_atmos:
type: boolean
description: Exclude Atmos audio tracks (default - false)
default: false
description: >-
Exclude Atmos audio tracks.
wanted:
type: array
items:
type: string
description: Wanted episodes (e.g., ["S01E01", "S01E02"]) or music tracks by their number in the track list (e.g., ["1-5"], ["2x3"] for disc 2 track 3) (default - all)
oneOf:
- type: string
- type: array
items:
type: string
default: []
description: >-
Episodes or seasons to download, as a list or as one comma-separated string, such as `["S01E01",
"S01E02"]`. Takes the part form `"S01E01.2"` and the air-date forms `"2026-08-11"` and
`"2026-08-01:2026-08-31"`. For a music release, a selector is a number in the track list, `"1-5"` or
`"1,3,7"`, or `"{disc}x{track}"` such as `"2x3"`. An empty list downloads all titles.
latest_episode:
type: boolean
description: Download only the single most recent episode (default - false)
default: false
description: >-
Download only the most recent episode.
latest_episodes:
type: integer
minimum: 1
description: Download only the N most recent episodes; overrides latest_episode (default - null)
description: >-
Download only the N most recent episodes. It overrides `latest_episode`.
max_downloads:
type: integer
minimum: 1
description: >-
Stop after N titles have downloaded. A skipped title, or a title already in the completion archive,
does not count (default - null)
Stop the job after N titles have downloaded. A title in `skipped_titles` or `already_present` does
not count.
lang:
type: array
items:
type: string
description: Language for video and audio (use 'orig' for original; a '-' prefix excludes, e.g. ["all", "-es"]) (default - ["orig"])
default: ["orig"]
description: >-
Languages for video and audio. `orig` is the original language, and a `-` prefix excludes a
language, as in `["all", "-es"]`.
v_lang:
type: array
items:
type: string
description: Language for video tracks only (a '-' prefix excludes) (default - [])
default: []
description: >-
Languages for video tracks only. A `-` prefix excludes a language.
a_lang:
type: array
items:
type: string
description: Language for audio tracks only (a '-' prefix excludes) (default - [])
default: []
description: >-
Languages for audio tracks only. A `-` prefix excludes a language.
s_lang:
type: array
items:
type: string
description: Language for subtitle tracks (a '-' prefix excludes, e.g. ["all", "-es"]); a missing one is skipped with a warning (default - ["all"])
default: ["all"]
description: >-
Languages for subtitle tracks. A `-` prefix excludes a language, as in `["all", "-es"]`. A missing
language gives a warning and the job continues.
require_audio:
type: array
items:
type: string
description: Audio languages that must exist, else the job fails or, with skip_missing, skips the title (default - [])
default: []
description: >-
Audio languages that must exist. When one is missing, the job fails, also with `best_available`, or
skips the title with `skip_missing`.
require_video:
type: array
items:
type: string
description: Video languages that must exist, else the job fails or, with skip_missing, skips the title (default - [])
default: []
description: >-
Video languages that must exist. When one is missing, the job fails, also with `best_available`, or
skips the title with `skip_missing`.
require_subs:
type: array
items:
type: string
description: Subtitle languages that must exist, else the job fails or, with skip_missing, skips the title (default - [])
default: []
description: >-
Subtitle languages that must exist. When one is missing, the job fails, or skips the title with
`skip_missing`. `s_lang` still selects the subtitles to keep.
skip_missing:
type: boolean
description: Skip a title that misses a required language or track and continue with the next title; the job fails when it skips every title (default - false)
default: false
description: >-
Skip a title that misses a required language or track, and continue with the next title. The
`skipped_titles` of the job lists each skip. The job fails when it has one title or skips all
titles.
skip_existing:
type: boolean
default: false
description: >-
Skip a variant that the completion archive of this API key records as complete, matched after track
selection by service, title ID, quality, range and codec. It does not read the files on disk or
compare the audio and subtitle choices.
force:
type: boolean
default: false
description: >-
Ignore the completion archive for this job. The overwrite behaviour does not change.
forced_subs:
type: boolean
description: Include forced subtitle tracks (default - false)
default: false
description: >-
Include forced subtitle tracks.
forced_subs_only:
type: boolean
description: Download forced subtitle tracks and no other subtitle tracks, implies forced_subs (default - false)
default: false
description: >-
Download forced subtitle tracks and no other subtitle tracks. Implies `forced_subs`. Not valid with
`no_subs`, `video_only`, `audio_only` or `chapters_only`.
forced_s_lang:
type: array
items:
type: string
description: Languages wanted for forced subtitles, implies forced_subs (a '-' prefix excludes) (default - [])
default: []
description: >-
Languages for forced subtitles. Implies `forced_subs`. A `-` prefix excludes a language.
exact_lang:
type: boolean
description: A language tag without a region never falls back to another variant; a tag with a region is always exact (default - false)
default: false
description: >-
A language tag without a region never falls back to another variant. A tag with a region is always
exact.
sub_format:
type: string
description: Output subtitle format such as SRT or VTT, or "original" to keep the source format (default - None)
description: >-
Output subtitle format, such as SRT or VTT, or `original` to keep the source format.
sub_font:
type: string
description: Font for subtitles converted to ASS, implies sub_format ASS (default - None)
description: >-
Font for subtitles converted to ASS. Implies `sub_format` ASS. With another `sub_format`, the
request returns `400`.
video_only:
type: boolean
description: Only download video tracks (default - false)
default: false
description: >-
Download only video tracks. Two or more of `video_only`, `audio_only`, `subs_only` and `chapters_only` combine, as on the CLI.
audio_only:
type: boolean
description: Only download audio tracks (default - false)
default: false
description: >-
Download only audio tracks. Two or more of `video_only`, `audio_only`, `subs_only` and `chapters_only` combine, as on the CLI.
subs_only:
type: boolean
description: Only download subtitle tracks (default - false)
default: false
description: >-
Download only subtitle tracks. Two or more of `video_only`, `audio_only`, `subs_only` and `chapters_only` combine, as on the CLI.
chapters_only:
type: boolean
description: Only download chapters (default - false)
default: false
description: >-
Download only chapters. Two or more of `video_only`, `audio_only`, `subs_only` and `chapters_only` combine, as on the CLI.
no_subs:
type: boolean
description: Do not download subtitle tracks (default - false)
default: false
description: >-
Do not download subtitle tracks.
skip_subtitle_errors:
type: boolean
description: Skip a subtitle that fails to download and keep the other tracks (default - false)
default: false
description: >-
Skip a subtitle that fails to download and keep the other tracks.
no_audio:
type: boolean
description: Do not download audio tracks (default - false)
default: false
description: >-
Do not download audio tracks.
no_chapters:
type: boolean
description: Do not download chapters (default - false)
default: false
description: >-
Do not download chapters.
no_video:
type: boolean
description: Do not download video tracks (default - false)
default: false
description: >-
Do not download video tracks.
no_attachments:
type: boolean
description: Do not download or mux attachments such as cover art or subtitle fonts (default - false)
default: false
description: >-
Do not download or mux attachments, such as cover art or subtitle fonts.
audio_description:
type: boolean
description: Download audio description tracks (default - false)
default: false
description: >-
Download audio description tracks.
audio_description_only:
type: boolean
description: Download audio description tracks and no standard audio tracks (default - false)
default: false
description: >-
Download audio description tracks and no standard audio tracks. Not valid with `no_audio`,
`video_only`, `subs_only` or `chapters_only`.
slow:
oneOf:
- type: boolean
- type: string
description: Add randomized delay between downloads. `true` for default 60-120s, or `"MIN-MAX"` string (e.g., `"20-40"`). Min must be >= 20 (default - null)
- type: array
items:
type: integer
description: >-
Add a random delay between title downloads. `true` is 60-120 seconds. `"MIN-MAX"` or `[MIN, MAX]`
sets the window in seconds, such as `"20-40"`. MIN must be 5 or more and not more than MAX.
split_audio:
type: boolean
description: Make separate output files per audio codec instead of merging all audio (default - null)
skip_existing:
type: boolean
description: Skip resolved variants in the caller completion archive without checking files on disk (default - false)
force:
type: boolean
description: Bypass the completion archive check without changing overwrite behaviour (default - false)
description: >-
Make one output file for each audio codec, instead of one file with all audio.
skip_dl:
type: boolean
description: Skip downloading, only retrieve decryption keys (default - false)
default: false
description: >-
Skip the download and get only the content keys.
all_drm:
type: boolean
description: License each track with both Widevine and PlayReady. A DRM system sends a challenge only for a KID that no vault has, unless `cdm_only` is true. Needs a CDM for each DRM system and cannot be used with `cdm` (default - false)
default: false
description: >-
License each track with both Widevine and PlayReady. Needs a CDM for each DRM system. A DRM system
sends a challenge only for a KID that no key vault has, unless `cdm_only` is true. Not valid with
`cdm`, which selects one device.
export:
type: boolean
description: Export manifest, DRM init data, keys, and track info to a JSON file in the exports directory (default - false)
default: false
description: >-
Export the manifest, DRM init data, keys and track information to a JSON file in the exports
directory.
cdm_only:
type: boolean
description: Only use CDM for content key retrieval (true) or only vaults (false). With `remote`, true licenses every track with the CDM of this server and uses no CDM or vault of the remote server (default - None)
cdm:
type: string
description: CDM device name on the server to license with, overriding the cdm config mapping. Requires serve.cdm_overrides to allow it (default - None)
description: >-
Get content keys only from the CDM (`true`) or only from key vaults (`false`). With `remote`, `true`
licenses each track with the CDM of this server and uses no CDM or key vault of the remote server.
proxy:
type: string
description: Full proxy URI on a public host, a Control D resolver as controld://<resolver>@dns.controld.com, or a country code when the API key has server_proxy (default - None)
description: >-
Proxy for all requests. Without `server_proxy` on the API key, it must be a full proxy URI on a
public host. With `server_proxy`, it can also be a country code, which the proxy providers of the
server resolve. A Control D resolver, `controld://<resolver>@dns.controld.com`, is a full proxy URI:
the server runs a forwarder for it.
no_proxy:
type: boolean
description: Force disable all proxy use (default - false)
default: false
description: >-
Use no proxy.
no_proxy_download:
type: boolean
description: Bypass proxy for all downloads. Manifest, license, and auth still use proxy (default - false)
default: false
description: >-
Use no proxy for the downloads. Manifest, licence and authentication requests still use `proxy`.
proxy_download:
type: string
description: Proxy for the downloads only, in the same form as proxy. Manifest, license, and auth use proxy (default - None)
tag:
type: string
description: Set the group tag (default - None)
tmdb_id:
type: integer
description: Use this TMDB ID for tagging instead of a title search. Set enrich to also take its title, year and original language. Mutually exclusive with imdb_id and tvdb_id. Needs tmdb_api_key (default - None)
anilist_id:
oneOf:
- type: integer
- type: string
description: AniList ID for tagging instead of a title search, or a MyAnimeList ID as the string mal:21. Combines with one of tmdb_id, imdb_id and tvdb_id, which wins over the IDs mapped from AniList (default - None)
enrich:
type: boolean
description: Overwrite show title, year and original language with the external source's. Requires one of tmdb_id, imdb_id, tvdb_id or anilist_id (default - false)
daily:
type: boolean
description: Treat the title as daily content and fill missing air dates from TVDB. Needs enrich (default - false)
description: >-
Proxy for the downloads only, in the same form as `proxy`. Manifest, licence and authentication
requests use `proxy`.
no_folder:
type: boolean
description: Disable folder creation for TV shows (default - false)
default: false
description: >-
Make no folder for a series.
no_source:
type: boolean
description: Disable source tag from output file name (default - false)
default: false
description: >-
Leave the source tag out of the output file name.
no_mux:
type: boolean
description: Do not mux tracks into a container file (default - false)
include_sample:
type: boolean
description: Also cut a 60 second sample from each muxed file into a Sample folder next to it (default - false)
default: false
description: >-
Do not mux the tracks into a container file.
sample:
oneOf:
- type: boolean
- type: string
description: Download a short sample and write it to a Sample folder. `true` for 60 seconds from 2 minutes in, or a `"START-END"` string in seconds (e.g., `"0-60"`) (default - null)
description: >-
Download a short sample and write it, with a `SAMPLE` tag in the file name, to a `Sample` folder in
the output folder. `true` is 60 seconds from 2 minutes in. `"START-END"` is a window in seconds,
such as `"0-60"`.
include_sample:
type: boolean
default: false
description: >-
Download the full title, then also cut a 60 second sample from each muxed file into a `Sample`
folder next to it.
workers:
type: integer
description: Max workers/threads per track download (default - None)
minimum: 1
description: >-
Maximum threads for each track download.
adaptive_workers:
type: boolean
description: Scale per-track segment workers to measured CDN throughput, up to the workers cap (default - false)
default: false
description: >-
Scale the segment workers of each track to the measured CDN throughput, up to the `workers` limit.
download_processes:
type: integer
description: Split a track's segments across this many processes. Only engages for large batches (default - 1)
minimum: 1
default: 1
description: >-
Split the segments of a track across this number of processes. Only a large batch uses them.
continue_downloads:
type: boolean
description: Keep completed segment files across runs and resume a previously failed download (default - false)
default: false
description: >-
Keep the completed segment files across runs and continue a download that failed before.
downloads:
type: integer
description: Amount of tracks to download concurrently (default - 1)
best_available:
type: boolean
minimum: 1
default: 1
description: >-
Continue with best available if requested quality unavailable (default - false).
An API key with a server_cdm_max_height for the service cannot set it.
generate_dv:
type: boolean
description: >-
With HYBRID in range, make Dolby Vision from the HDR10+ metadata or the decoded video
when a title has no Dolby Vision track (default - false). With HDR10 or HDR10P in range
and no HYBRID, make it for that base and ignore a Dolby Vision track. With none of the
three in range, the field has no effect.
Number of tracks to download at the same time.
worst:
type: boolean
default: false
description: >-
Select the lowest bitrate track within the specified quality, or at the lowest resolution if no
quality is set (default - false)
Select the lowest-bitrate video at each resolution in `quality`, or at the lowest resolution when
`quality` is empty.
best_available:
type: boolean
default: false
description: >-
Continue with the best available quality when the requested quality is not available. With
`all_drm`, a DRM system that does not license is a warning. An API key with a
`server_cdm_max_height` for the service cannot set it.
generate_dv:
type: boolean
default: false
description: >-
With HYBRID in `range`, make Dolby Vision from the HDR10+ metadata or the decoded video when a title
has no Dolby Vision track. With HDR10 or HDR10P in `range` and no HYBRID, make it for that base and
ignore a Dolby Vision track. With none of the three in `range`, the field has no effect.
repack:
type: boolean
description: Add REPACK tag to the output filename (default - false)
default: false
description: >-
Add a REPACK tag to the output file name.
tag:
type: string
description: >-
Release group tag.
tmdb_id:
type: integer
minimum: 1
description: >-
Use this TMDB ID for tagging instead of a title search. Set `enrich` to also take its title, year
and original language. Not valid with `imdb_id` or `tvdb_id`. Needs `tmdb_api_key` on the server.
imdb_id:
type: string
description: Use this IMDB ID (e.g. tt1375666) for tagging instead of a title search. Set enrich to also take its title, year and original language. Mutually exclusive with tmdb_id and tvdb_id (default - None)
description: >-
Use this IMDB ID for tagging instead of a title search. It must look like `tt1375666`. Set `enrich` to also
take its title, year and original language. Not valid with `tmdb_id` or `tvdb_id`.
tvdb_id:
type: integer
description: Use this TVDB ID for tagging and episode ordering instead of a series lookup. Set enrich to also take its title, year and original language. Mutually exclusive with tmdb_id and imdb_id. Needs tvdb_api_key (default - None)
minimum: 1
description: >-
Use this TVDB ID for tagging and episode order instead of a series lookup. Set `enrich` to also take
its title, year and original language. Not valid with `tmdb_id` or `imdb_id`. Needs `tvdb_api_key`
on the server.
tvdb_order:
type: string
enum: [official, dvd, absolute, alternate, regional]
description: Renumber episodes to a TVDB season order (default - the tvdb_order config option)
description: >-
Renumber the episodes to a TVDB season order. Without a value, the `tvdb_order` config option sets
the order.
continuous_episodes:
type: boolean
description: Number each season on from the season before it, e.g. S02E05 after a four-episode season one (default - false)
default: false
description: >-
Number each season on from the season before it, so season two starts at episode 5 after four
episodes. Season 0 and episode 0 keep their numbers. `wanted` selects by the new numbers, but the
list endpoints show the numbers of the service.
anilist_id:
oneOf:
- type: integer
- type: string
description: >-
Use this AniList ID, a positive integer, for tagging instead of a title search, or a MyAnimeList ID as a string such as `mal:21`. Combines with one of `tmdb_id`, `imdb_id` and `tvdb_id`, which wins over the IDs that
AniList maps. Needs no API key.
enrich:
type: boolean
default: false
description: >-
Overwrite the show title, year and original language with those of the external source. Needs one of
`tmdb_id`, `imdb_id`, `tvdb_id` or `anilist_id`.
daily:
type: boolean
default: false
description: >-
Treat the title as daily content and fill missing episode air dates from TVDB. The fill needs
`enrich` and a TVDB ID. An air date that the service sets stays.
output_dir:
type: string
description: >
Output directory for this download, relative to the server's downloads
directory. A path resolving outside it is rejected (default - None).
description: >-
Output directory for this download, relative to the downloads directory of the server. The server refuses a path that resolves outside it with `400`.
no_cache:
type: boolean
description: Bypass title cache for this download (default - false)
default: false
description: >-
Bypass the title cache for this download.
reset_cache:
type: boolean
description: Clear title cache before fetching (default - false)
default: false
description: >-
Clear the title cache before the title lookup.
remote:
type: string
description: >-
A `remote_services` server name from `GET /api/config`. The service runs through that server (login,
titles, tracks, licences); the download still runs on this server.
client_name:
type: string
description: >-
Names this client on the dashboard of the remote server, as `serve (<client_name>)`.
cdm:
type: string
description: >-
CDM device name on the server to license with, in place of the `cdm` config mapping. Needs
`serve.cdm_overrides` to allow it.
responses:
'202':
description: Download job created