Skip to content

REST API Endpoints

This is the full endpoint reference for the unshackle REST API. It covers every route: its method and path, the request body it accepts, the response shape it returns, and the status codes it can give. This page groups the routes into general, download jobs, server management, remote sessions, and the remote services relay.

Start the server with unshackle serve. By default it binds to 127.0.0.1:8786, and every route lives under the /api/ prefix. The Authentication page gives authentication, server modes, and the X-Secret-Key header in detail. Read that first if you have not already. For an end-to-end walkthrough, see the REST API Quick Start.

Base URL

All examples below assume a base URL of http://127.0.0.1:8786. Replace the host and port so that they match your own unshackle serve -h <host> -p <port> invocation.

Interactive docs

The server mounts a live Swagger UI at /api/docs/ whenever it does not operate in --remote-only mode. Its title is "Unshackle REST API" and its version tracks the installed package version. In API-only mode with an API key configured, the Swagger UI itself sits behind X-Secret-Key, like every other route.

Conventions

  • Authentication. Every request, GET /api/health included, requires the X-Secret-Key header when you configure an API key. --no-key disables the check entirely. See Authentication.
  • Content type. Request bodies are JSON (Content-Type: application/json). All success responses are JSON unless this page documents a 204 No Content.
  • CORS. Every response carries permissive CORS headers, and the server answers OPTIONS preflight requests automatically.
  • Compression. JSON responses of 256 bytes or more are gzip-compressed when the client sends Accept-Encoding: gzip. A slow response is not compressed.
  • Service allowlist. The effective allowlist for your API key filters the service-facing endpoints (the intersection of the global serve.services list and your per-key list). The server treats services you cannot use as unknown.
  • Remote services. A full-mode server can run a service through one of its own remote_services servers. See Remote services relay.

Error responses have two shapes

Structured application errors (raised inside a handler) return {"status": "error", "error_code": "...", "message": "...", "timestamp": "..."}. The authentication middleware, however, returns a different shape: {"status": 401, "message": "..."} with an integer status and no error_code. The same middleware answers 429 in that shape when an API key goes over its rate limit. Clients must accept both shapes. The Error responses section at the bottom of this page gives the full error model.


General endpoints

These endpoints report server state and enumerate what is available. GET /api/health, GET /api/services, and POST /api/search are also exposed in --remote-only mode.

GET /api/health

Health check. It reports the running version and commit and a best-effort update check, so it needs the X-Secret-Key header like every other route. A request without an API key gets a 401, which still shows the server is up.

curl -H "X-Secret-Key: $SECRET" http://127.0.0.1:8786/api/health
{
  "status": "ok",
  "version": "5.3.0",
  "code_hash": "1d22a1e",
  "draining": false,
  "update_check": {
    "update_available": false,
    "current_version": "5.3.0",
    "latest_version": "5.3.0"
  }
}

code_hash fingerprints the framework source the server operates, so it names the code itself rather than the release. It is the same value for a git checkout and for an installed package built from that checkout. It changes when you edit anything under unshackle/core, unshackle/commands, unshackle/utils, or unshackle/vaults. Service modules are not included. unshackle sets the value to null only when it cannot read the source files.

draining is true while the server refuses new remote sessions and jobs before a restart.

The server asks GitHub for the latest release at most once per update_check_interval hours and answers from its cache between checks.

If the update check fails (for example, no network), update_available and latest_version are null while current_version still reports the installed version.

Status Meaning
200 Server is healthy.

GET /api/services

Show the streaming services available on this server, filtered by your allowlist. Each entry gives the service's tag, matching rules, capability flags, and its CLI parameters (useful when you make a UI that accepts service-specific options). For the admin key, load_errors lists the services the server skipped because they failed to import, at startup or after a service repository refresh; the server also writes each one to its log. Any other key gets an empty list; with --no-key every caller is the admin. An entry marked pending_update has newer code staged: it keeps its current code until its running or queued jobs and its live remote sessions finish.

curl -H "X-Secret-Key: $KEY" http://127.0.0.1:8786/api/services
{
  "services": [
    {
      "tag": "EXAMPLE",
      "aliases": ["EX"],
      "geofence": ["US"],
      "geoblock": [],
      "title_regex": "^https?://example\\.com/.+",
      "url": "https://example.com",
      "help": "EXAMPLE\nAuthorization: Cookies\nSecurity: FHD@L3",
      "cli_params": [
        {"name": "title", "kind": "argument", "required": true},
        {
          "name": "movie",
          "kind": "option",
          "opts": ["-m", "--movie"],
          "secondary_opts": [],
          "is_flag": true,
          "default": false,
          "help": "Title is a movie.",
          "type": "boolean",
          "multiple": false
        }
      ],
      "needs_auth": true,
      "has_search": true,
      "anonymous_search": false,
      "has_drm": true,
      "auth_methods": ["cookies"]
    }
  ],
  "load_errors": []
}

Field notes:

Field Description
tag Canonical service tag; use this as the service value on other endpoints.
aliases Alternate tags the service also answers to.
geofence Region codes the service is geofenced to (may be empty).
geoblock Region codes where the service refuses to work (may be empty).
title_regex URL/ID pattern the service matches, as a string or list of strings (or null).
url Service URL, taken from the service's CLI short help.
help The service module's docstring.
cli_params Array of parameter descriptors. Arguments have {name, kind: "argument", required}; options have {name, kind: "option", opts, secondary_opts, is_flag, default, help, type, multiple} and, for choice options, a choices list. secondary_opts holds the off names of a boolean flag such as --x/--no-x, and is empty for other options.
needs_auth Whether the service overrides authenticate().
has_search Whether the service supports POST /api/search.
anonymous_search Whether POST /api/search operates with no login for this service. The server then ignores credentials and cookies on a search.
has_drm Whether the service overrides a Widevine or PlayReady licence hook.
pending_update Set to true while a service repository refresh waits for this service's jobs to finish before it swaps in the new code. Absent otherwise.
server_accounts Present when the server lends its own accounts for this service: {regions: ["ca", "gb"], global: bool}, the regions those accounts cover. A client sends no credentials, cookies, or cache for such a service.
auth_methods Declared or inferred auth methods, e.g. ["cookies"], ["credentials"].
Status Meaning
200 Service list returned.
422 Unexpected server error (INTERNAL_ERROR).

POST /api/search

Find titles in a service by query string. The service must have a search() method (see has_search above).

For a service with anonymous_search, the server does not log in and ignores credentials and cookies. The server account check still applies.

Request body

Field Type Required Default Description
service string yes - Service tag.
query string yes - Search query.
profile string no null Credential/cookie profile to use.
proxy string no null 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.
no_proxy boolean no false Force-disable all proxy use.
credentials, cookies, cache - no null Your own login material, on a --remote-only server only. See Client cache on a remote-only server.
dl_params object no null The dl track selection, as on POST /api/session/create.
curl -X POST http://127.0.0.1:8786/api/search \
  -H "X-Secret-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"service": "EXAMPLE", "query": "planet earth"}'
{
  "results": [
    {
      "id": "12345",
      "title": "Planet Earth",
      "description": "A nature documentary series.",
      "label": "Available",
      "url": "https://example.com/title/12345"
    }
  ],
  "count": 1
}
Status Error code Meaning
200 - Search completed.
400 INVALID_PARAMETERS Missing query.
400 INVALID_SERVICE Unknown or disallowed service.
400 INVALID_PROXY Proxy could not be resolved.
422 SERVICE_ERROR Service failed to initialise, or does not support search.

POST /api/list-titles

Get the list of titles behind a title ID, for example episodes or a movie, without downloading anything.

Request body

Field Type Required Description
service string yes Service tag.
title_id string yes Title identifier.
profile string no Credential/cookie profile.
proxy string no 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.
no_proxy boolean no Force-disable proxy.
cdm_type string no Preferred CDM type. A request that sets one of the service's SERVER_DEVICE_OPTIONS ignores it: the server loads the first-listed device of its cdm entry.
credentials, cookies, cache - no Your own login material, on a --remote-only server only. See Client cache on a remote-only server.

You can also pass a service's own CLI options, in a nested service_params object or as additional keys. When the body has service_params, the server reads service options only from it. To turn off a flag such as --x/--no-x, send false under its name ("x": false), not under its off name.

Logins that need the user

search, list-titles and list-tracks have no channel to the user. A login that asks for input or waits for an approval on another device fails at once with AUTH_FAILED on these endpoints. Complete that login in a download job or a remote session, then send the saved login with the request.

Client cache on a remote-only server

A --remote-only server keeps nothing that a client sends. When the request does not use a server account, the server runs search, list-titles and list-tracks on a new service cache directory for that request only, and removes the directory when the request ends, on success and on error. A --remote-only server exposes only search of these three endpoints, so the rule applies to list-titles and list-tracks only if a later release exposes them in that mode.

credentials ({username, password, extra?}) and cookies (base64 of a zlib-compressed Netscape cookie file) are the same as on POST /api/session/create. cache is a map of cache files in the form that Cache files gives. The server writes these files into the request cache directory before the service authenticates.

When you send credentials, cookies or cache, a successful response also has a cache field in the same form, with the updated files (for example a refreshed token), but no titles_ files. Save them to send with the next request. A request that uses a server account, or a request to a full-mode server, uses the server's own cache and returns no cache field.

curl -X POST http://127.0.0.1:8786/api/list-titles \
  -H "X-Secret-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"service": "EXAMPLE", "title_id": "12345"}'
{
  "titles": [
    {
      "type": "episode",
      "name": "Pilot",
      "id": "ep-1",
      "language": "en",
      "description": "The first episode.",
      "date": "2020-01-01",
      "cover_url": "https://example.com/cover.jpg",
      "year": 2020,
      "series_title": "Example Show",
      "season": 1,
      "number": 1
    }
  ]
}

Each serialised title carries type ("episode", "movie", "song", or "other"), name, id, language, description, date, and cover_url. Episodes and movies add year. Episodes also add series_title, season, and number.

The number that wanted takes for a song

A song adds year and its music fields, such as artist, album, disc, track and position. wanted takes position when it is not null, else disc and track as in "2x3".

These keys are sent only when the title carries them:

Key Type On Meaning
availability object all Optional account-scoped metadata: paid is a boolean describing the catalogue offer; access is "granted", "denied", or "unknown". Both fields are optional; missing or unknown access is not denial. Only these allowlisted fields are forwarded, including through remote services.
part integer episode Part index of a split episode, counting from 1.
air_date string episode ISO air date of daily and date-based content. unshackle names the episode by date instead of SxxExx.
absolute integer episode Absolute episode number across all seasons.
daily boolean episode The episode is daily/date-based. Set from the title, or from the service's DAILY class attribute.
sport boolean episode The episode is a sports event, so it uses the sports output template when one is set. Sent only when true.
anime boolean episode, movie The title is anime, so metadata lookups prefer AniList. Set from the title, or from the service's ANIME class attribute.
metadata_provider string episode, movie The metadata provider that lookups for this title try first. Set from the title, or from the service's METADATA_PROVIDER class attribute. Sent only when set.

part on a split episode

A service that splits one episode into several separately playable videos reports each one as its own episode. Those titles share a season and number and add a part integer counting from 1. No other title carries the part field, so a client can ignore it safely. See Split episodes.

Status Error code Meaning
200 - Titles returned.
400 INVALID_INPUT Missing service or title_id.
400 INVALID_PARAMETERS Invalid dl value, such as an unknown codec in dl_params.
400 INVALID_SERVICE Unknown or disallowed service.
401 AUTH_FAILED Authentication with the service failed.
404 NOT_FOUND Title not found.
422 INTERNAL_ERROR Unexpected error.

POST /api/list-tracks

Show the video, audio, and subtitle tracks for a title. For series, you can scope to specific episodes. Each title in the response has the form of a list-titles title, with the same service flags (anime, daily, metadata_provider).

Spotting the original-language audio

Each audio track carries is_original, which marks the track the default lang of orig selects. unshackle finds it with the same language matcher the downloader uses. Thus it stays correct for regional variants a client cannot separate from tag text alone (pt marks pt-BR rather than pt-PT). Services need not report a title's language, so every track can legitimately come back false.

Request body

Field Type Required Description
service string yes Service tag.
title_id string yes Title identifier.
wanted string / string[] no Episode/season range (e.g. "S01E01-S01E03"), or a song by its number in the track list (e.g. "1-5", "1,3,7", or "2x3" for disc 2 track 3). A list of selectors is accepted too.
season int/string no Season number (combined with episode).
episode int/string no Episode number (combined with season).
part int/string no Part index of a split episode (combined with season and episode).
profile, proxy, no_proxy, cdm_type - no As on list-titles.
credentials, cookies, cache - no As on list-titles.
dl_params object no The dl track selection that the service reads from ctx.parent.params: lang, v_lang, a_lang, s_lang, acodec, forced_subs and exact_lang, as on POST /api/session/create. Some services select the manifests they fetch from these values.

When you give both season and episode, the server combines them into a "{season}x{episode}" selector. part narrows that to "{season}x{episode}.{part}", one part of a split episode. Without part you get every part of the episode. The server reads part only when you give both season and episode, and wanted takes precedence over all three. To scope a part by range, put it in wanted instead ("S01E01.2").

{
  "title": { "type": "movie", "name": "Example Movie", "id": "12345", "year": 2021 },
  "video": [
    {
      "id": "v-1", "codec": "HEVC", "codec_display": "H.265",
      "bitrate": 8000, "bitrate_bps": 8000000, "width": 3840, "height": 2160,
      "resolution": "2160p", "fps": "24", "range": "HDR10",
      "range_display": "HDR", "scan_type": null, "closed_captions": [],
      "dv_compatible_bitstream": false, "hdr10plus": false, "hdr10_base": false, "hlg_base": false, "stereo": false, "language": "en",
      "is_original_lang": true,
      "name": null, "track_name": "English", "needs_repack": false, "edition": [], "note": null, "data": null,
      "drm": [], "descriptor": "DASH"
    }
  ],
  "audio": [
    {
      "id": "a-1", "codec": "EC3", "codec_display": "DDP",
      "bitrate": 640, "bitrate_bps": 640000, "channels": "5.1", "language": "en",
      "is_original": true, "is_original_lang": true, "atmos": false, "joc": 0,
      "descriptive": false, "bit_depth": null, "sample_rate": 48000, "name": null, "track_name": "English", "needs_repack": false, "edition": [],
      "note": null, "data": null, "drm": [], "descriptor": "DASH"
    }
  ],
  "subtitles": [
    { "id": "s-1", "codec": "vtt", "language": "en",
      "forced": false, "sdh": false, "cc": false, "is_original_lang": false,
      "name": null, "track_name": "English", "needs_repack": false, "edition": [], "note": null, "data": null,
      "drm": [], "descriptor": "DASH" }
  ]
}
{
  "episodes": [
    {
      "title": { "type": "episode", "name": "Pilot", "id": "ep-1", "season": 1, "number": 1 },
      "video": [ ... ],
      "audio": [ ... ],
      "subtitles": [ ... ]
    }
  ],
  "unavailable_episodes": [
    { "title": { "id": "ep-2" }, "error": "..." }
  ]
}

The server sorts tracks by bitrate, descending. Episodes the server cannot get go into unavailable_episodes, rather than failing the whole request. Track objects here do not include a download url. Only the remote session endpoints give segment URLs.

The drm array on a track is a list of {type, pssh?, kids?, content_keys?, license_url?} objects. Only a widevine, playready or clearkeycenc entry carries content_keys.

Every track carries the same fields as a local track: is_original_lang, name, needs_repack, edition, note, and data. name is the name the service set, or null. note is display text the service set, such as an encoding profile, or null: --list shows it, but the filename and the mux do not use it. track_name is the name --list shows and the mux writes to an audio or subtitle track: name when the service set one, else the name of the language (English, or in the language itself when the server sets muxing.track_names: native, or no name when it sets none), then the server's muxing.original_label on an original-language track, then the SDH, CC, Forced or Descriptive label. bitrate is in kb/s, and bitrate_bps gives the exact bits/s. data holds the part of the service-set track.data that fits in JSON, without the hls, dash, and ism parser keys. Audio keeps is_original and atmos for clients that read them, and adds the exact joc object count. Audio bit_depth and sample_rate (Hz) are integers, or null when the manifest and the service do not give them.

Status Error code Meaning
200 - Tracks returned.
400 INVALID_INPUT Missing service or title_id.
400 INVALID_PARAMETERS Invalid wanted range, or an invalid dl value.
400 INVALID_SERVICE Unknown or disallowed service.
404 NO_CONTENT No matching episodes, or all matches failed.

Download jobs

Downloads are asynchronous. POST /api/download enqueues a job and returns immediately with a job_id. The server runs each job in a background job worker subprocess. You then poll the job endpoints for progress and results.

Job states

A job moves through queued → downloading → one of the terminal states completed, failed, or cancelled. You can prioritise only queued jobs. You can retry or remove only terminal jobs. When the server stops, it cancels each queued and downloading job and refuses a new job with SERVER_DRAINING (409).

POST /api/download

Make a download job. It requires service and title_id. Every other field is an optional download parameter with a server-side default. On success this returns 202 Accepted, not 200.

curl -X POST http://127.0.0.1:8786/api/download \
  -H "X-Secret-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service": "EXAMPLE",
    "title_id": "12345",
    "quality": [2160],
    "vcodec": "HEVC",
    "range": ["HDR10"],
    "wanted": ["S01E01"]
  }'
{
  "job_id": "b0f7c8e2-4a1d-4e9c-9b7e-2f3a1c0d5e6f",
  "status": "queued",
  "created_time": "2026-07-03T12:00:00+00:00"
}

Request body. Every field except service and title_id is optional. The dl fields mirror the flags of the dl command. This table comes from the OpenAPI description that /api/docs/ of a running server also shows.

Field Type Default Description
service string required Service tag.
title_id string required Title identifier.
profile string null Profile for credentials and cookies.
quality integer[] [] 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 string / string[] [] 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 string / string[] [] 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 integer ≥ 1 null Video bitrate in kbps.
abitrate integer ≥ 1 null Audio bitrate in kbps.
vbitrate_range string null 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 string null Audio bitrate window in kbps as "MIN-MAX", such as "128-256". Selects the highest bitrate in the window. Not valid with abitrate.
range string[] ["SDR"] 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 number null Audio channels, a positive number such as 2.0, 5.1 or 7.1. 5.1 also matches a 6.0 layout.
no_atmos boolean false Exclude Atmos audio tracks.
wanted string / string[] [] 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 boolean false Download only the most recent episode.
latest_episodes integer ≥ 1 null Download only the N most recent episodes. It overrides latest_episode.
max_downloads integer ≥ 1 null Stop the job after N titles have downloaded. A title in skipped_titles or already_present does not count.
lang string[] ["orig"] Languages for video and audio. orig is the original language, and a - prefix excludes a language, as in ["all", "-es"].
v_lang string[] [] Languages for video tracks only. A - prefix excludes a language.
a_lang string[] [] Languages for audio tracks only. A - prefix excludes a language.
s_lang string[] ["all"] 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 string[] [] 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 string[] [] 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 string[] [] 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 boolean false 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 boolean false 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 boolean false Ignore the completion archive for this job. The overwrite behaviour does not change.
forced_subs boolean false Include forced subtitle tracks.
forced_subs_only boolean false 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 string[] [] Languages for forced subtitles. Implies forced_subs. A - prefix excludes a language.
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, such as SRT or VTT, or original to keep the source 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 boolean false Download only video tracks. Two or more of video_only, audio_only, subs_only and chapters_only combine, as on the CLI.
audio_only boolean false Download only audio tracks. Two or more of video_only, audio_only, subs_only and chapters_only combine, as on the CLI.
subs_only boolean false Download only subtitle tracks. Two or more of video_only, audio_only, subs_only and chapters_only combine, as on the CLI.
chapters_only boolean false Download only chapters. Two or more of video_only, audio_only, subs_only and chapters_only combine, as on the CLI.
no_subs boolean false Do not download subtitle tracks.
skip_subtitle_errors boolean false Skip a subtitle that fails to download and keep the other tracks.
no_audio boolean false Do not download audio tracks.
no_chapters boolean false Do not download chapters.
no_video boolean false Do not download video tracks.
no_attachments boolean false Do not download or mux attachments, such as cover art or subtitle fonts.
audio_description boolean false Download audio description tracks.
audio_description_only boolean false Download audio description tracks and no standard audio tracks. Not valid with no_audio, video_only, subs_only or chapters_only.
slow boolean / string / integer[] null 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 boolean null Make one output file for each audio codec, instead of one file with all audio.
skip_dl boolean false Skip the download and get only the content keys.
all_drm boolean false 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 boolean false Export the manifest, DRM init data, keys and track information to a JSON file in the exports directory.
cdm_only boolean null 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 string null 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 boolean false Use no proxy.
no_proxy_download boolean false Use no proxy for the downloads. Manifest, licence and authentication requests still use proxy.
proxy_download string null Proxy for the downloads only, in the same form as proxy. Manifest, licence and authentication requests use proxy.
no_folder boolean false Write the files directly in the output directory, with no folder for the title, for every kind of title.
no_source boolean false Leave the source tag out of the output file name.
no_mux boolean false Do not mux the tracks into a container file.
sample boolean / string null 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 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 integer ≥ 1 null Maximum threads for each track download.
adaptive_workers boolean false Scale the segment workers of each track to the measured CDN throughput, up to the workers limit.
download_processes integer ≥ 1 1 Split the segments of a track across this number of processes. Only a large batch uses them.
continue_downloads boolean false Keep the completed segment files across runs and continue a download that failed before.
downloads integer ≥ 1 1 Number of tracks to download at the same time.
worst boolean false Select the lowest-bitrate video at each resolution in quality, or at the lowest resolution when quality is empty.
best_available boolean false 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 boolean false 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 boolean false Add a REPACK tag to the output file name.
tag string null Release group tag.
tmdb_id integer ≥ 1 null 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 string null 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 integer ≥ 1 null 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 official, dvd, absolute, alternate, regional null Renumber the episodes to a TVDB season order. Without a value, the tvdb_order config option sets the order.
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.
anilist_id integer / string null 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 boolean false 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 boolean false 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 string null 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 boolean false Bypass the title cache for this download.
reset_cache boolean false Clear the title cache before the title lookup.
remote string null 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 string null Names this client on the dashboard of the remote server, as serve (<client_name>).
cdm string null CDM device name on the server to license with, in place of the cdm config mapping. Needs serve.cdm_overrides to allow it.

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.

Service options. A service's own CLI options travel in the same body. Send them in a nested service_params object, or as flat top-level keys. When the body has service_params, the server reads service options only from it, and every flat key is a dl value. A name in service_params can be the option's flag, such as zone for --zone, or its parameter name. Without service_params, a flat key that is also a dl option, such as quality or lang, stays a dl value, and the server logs a warning when the service has an option of the same name. An option you leave out takes the default declared on the service's cli command, so the job matches the equivalent dl run. The server checks each service option against that option's type, and a value it refuses gets 400 INVALID_PARAMETERS. profile at the top level always means the credential profile, never a service's own --profile option.

curl -X POST http://127.0.0.1:8786/api/download \
  -H "X-Secret-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "service": "EXAMPLE",
    "title_id": "12345",
    "quality": [2160],
    "service_params": {"device": "chrome", "movie": true}
  }'

Rejected parameters

postscript, post_script and post_scripts are never accepted. A body containing any of them gets 400 INVALID_PARAMETERS, because a command string that arrives from an HTTP caller would be remote code execution. You configure post-scripts only in unshackle.yaml, where they still operate for API jobs. See Post-scripts.

Gated parameters (developer)

The server accepts a few keys, but permits them only when the server config opts in. Otherwise the server rejects the request with 403 FORBIDDEN:

  • cdm (per-request CDM device name): allowed only if serve.cdm_overrides is true or a list containing that device name.
  • credential ("user:pass") and credentials (a map): allowed only if serve.allow_job_credentials is truthy (off by default).

On the server, unshackle merges the effective parameters in this order: defaults → serve: config overrides → service-specific defaults → your request body.

The server checks each serve: and services.<TAG>.dl value that a job uses with the rules of a request body. A bad value refuses the job with 400 INVALID_PARAMETERS, and the message starts with the config block, for example serve: workers must be a positive integer. A value that your request body replaces is not checked.

Status Error code Meaning
202 - Job queued.
400 INVALID_INPUT Missing service/title_id or malformed JSON.
400 INVALID_PARAMETERS A parameter failed validation.
400 INVALID_SERVICE Unknown or disallowed service.
403 FORBIDDEN A gated parameter is not permitted.
403 SERVER_CDM_CAPPED The API key has a server_cdm_max_height for the service, and the job has no quality at or under it, sets best_available, or has HYBRID in range.

GET /api/download/jobs

Show download jobs, with optional filtering and sorting.

Query parameters

Param Values Default Description
status queued, downloading, completed, failed, cancelled - Filter by status.
service service tag - Filter by service.
sort_by created_time, started_time, completed_time, progress, status, service created_time Sort field.
sort_order asc, desc desc Sort direction.
full true, false false Include full per-job details.
curl -H "X-Secret-Key: $KEY" \
  "http://127.0.0.1:8786/api/download/jobs?status=downloading&sort_by=progress&sort_order=desc"
{
  "jobs": [
    {
      "job_id": "b0f7c8e2-...",
      "status": "downloading",
      "created_time": "2026-07-03T12:00:00+00:00",
      "service": "EXAMPLE",
      "title_id": "12345",
      "title": "Example Show S01E01",
      "progress": 42.5,
      "phase": "downloading",
      "current_title": "Episode 1",
      "completed_tracks": 1,
      "total_tracks": 3,
      "active_tracks": ["v-1"],
      "track_progress": [{"label": "Video", "progress": 42.5, "speed": "5.2 MB/s"}],
      "segments_done": 120,
      "segments_total": 300,
      "speed": "5.2 MB/s",
      "skipped_subtitles": [],
      "skipped_titles": [],
      "already_present": [],
      "input_prompt": null,
      "notice": null,
      "qr": null
    }
  ]
}

With full=true, each job additionally includes parameters (with secrets redacted), started_time, completed_time, output_files, error_message, error_details, and error_code. When you start the server with --debug-api, each job also includes error_traceback and worker_stderr.

Status Error code Meaning
200 - Jobs returned.
400 INVALID_PARAMETERS Invalid sort_by or sort_order.

GET /api/download/jobs/{job_id}

Fetch a single job with full details (equivalent to a full=true list entry).

Status Error code Meaning
200 - Job returned.
404 JOB_NOT_FOUND No such job.

GET /api/download/jobs/{job_id}/events

Stream the job's progress as Server-Sent Events. Use this instead of polling GET /api/download/jobs/{job_id}.

The response has the content type text/event-stream. Each event has this format:

event: <name>
data: <job JSON>

The data field of every event is the same job object that GET /api/download/jobs/{job_id} returns.

Event When it is sent
snapshot Immediately, as the first event. Gives the job's current state.
status The job leaves the queue and starts to download.
progress The worker's progress record changed. The server reads that record every 0.5 seconds, so you get at most two of these events each second, and none while the record stays the same.
completed The job finished. The server then closes the event stream.
failed The job failed. The server then closes the event stream.
cancelled The job was cancelled. The server then closes the event stream.

The server sends a : keep-alive comment each 15 seconds while the job is quiet, to keep proxies from closing an idle connection. Ignore these lines.

If the job is already in a terminal state, the server sends the snapshot event, then the terminal event, and closes the event stream immediately.

Authentication from a browser

EventSource cannot set headers. For this endpoint only, the server also accepts the API key in the secret_key query parameter. This works in both server modes, the default integrated server and --api-only:

const events = new EventSource(
  `http://127.0.0.1:8786/api/download/jobs/${jobId}/events?secret_key=${key}`
);
events.addEventListener("progress", (e) => console.log(JSON.parse(e.data).progress));
events.addEventListener("completed", () => events.close());

The header always wins. Send the API key in the query parameter or in the header, not both. If an X-Secret-Key header is present, the server examines that header and ignores the query parameter. See Authentication.

curl -N -H "X-Secret-Key: $KEY" \
  "http://127.0.0.1:8786/api/download/jobs/b0f7c8e2-.../events"
event: snapshot
data: {"job_id":"b0f7c8e2-...","status":"downloading","progress":42.5,...}

event: progress
data: {"job_id":"b0f7c8e2-...","status":"downloading","progress":48.0,...}

: keep-alive

event: completed
data: {"job_id":"b0f7c8e2-...","status":"completed","progress":100.0,...}
Status Error code Meaning
200 - Event stream started.
404 JOB_NOT_FOUND No such job.

DELETE /api/download/jobs/{job_id}

Cancel or remove a job. The behaviour depends on the job's current state:

  • Terminal job (completed/failed/cancelled): removed from the manager, returning 204 No Content with an empty body.
  • Queued or downloading job: cancelled, returning 200 {"status": "success", "message": "Job cancelled"}.

Warning

A 204 response has no body. Do not try to parse JSON from it.

Status Error code Meaning
200 - Job cancelled.
204 - Terminal job removed (empty body).
400 INVALID_PARAMETERS Job is in a state that cannot be cancelled.
404 JOB_NOT_FOUND No such job.

POST /api/download/jobs/clear-finished

Remove every terminal (completed/failed/cancelled) job from the manager. No request body.

{ "removed": 3 }

POST /api/download/jobs/{job_id}/retry

Enqueue a new job from the request that made a terminal job. The request goes through the same checks as a new submission: the service allowlist, the parameter checks and the download gates. A parameter that the request did not send takes the server default of the time of the retry. Returns 202 with the new job's ID.

Retry reuses the original, unredacted parameters

A retry sends again the parameters that the original client submitted, including any secrets such as credential/credentials. It does not use the redacted parameters view that GET /api/download/jobs and GET /api/history give. This is deliberate: it lets a retried job reproduce a credentialed download that the redacted job record alone never could. The API masks those credentials everywhere else. But anyone who can retry a job can operate it again with the original credentials.

{
  "job_id": "9c1e2f3a-...",
  "status": "queued",
  "created_time": "2026-07-03T12:05:00+00:00"
}
Status Error code Meaning
202 - New job queued.
404 JOB_NOT_FOUND No such job.
409 CONFLICT Job is not in a terminal state.
400 INVALID_SERVICE Service is no longer allowed.
400 INVALID_PARAMETERS A parameter no longer passes the checks, for example an output_dir outside a moved downloads directory.
403 FORBIDDEN A gated parameter is no longer permitted.
403 SERVER_CDM_CAPPED The job is no longer inside the server_cdm_max_height of the API key.

POST /api/download/jobs/{job_id}/priority

Move a queued job to the front of the download queue.

{ "job_id": "b0f7c8e2-...", "position": "front" }
Status Error code Meaning
200 - Job moved to front.
404 JOB_NOT_FOUND No such job.
409 CONFLICT Job is not queued.

POST /api/download/jobs/{job_id}/input

Answer the prompt that a running job waits on. A service can ask for input during a job, for example an OTP code, a PIN, or a device-code confirmation. The job then shows the prompt in its input_prompt field and in its progress events. Show the prompt to the user and send the answer here.

A job that waits for an approval on another device, such as a pair code login, shows the message in its notice field instead. A notice needs no answer: show it to the user and keep polling. When the login is a QR code to scan, the job also sets qr to the text of the code: draw it as a QR code beside the prompt or notice.

{ "response": "123456" }
{ "status": "accepted" }
Status Error code Meaning
200 - Answer sent to the job. The input_prompt field goes back to null.
400 INVALID_INPUT The body is not JSON, or it has no response.
404 JOB_NOT_FOUND No such job.
409 CONFLICT The job does not wait on a prompt.

Warning

The job keeps its download slot while it waits. It fails with AUTH_FAILED if nobody answers the prompt within 10 minutes.


Server management

Endpoints for profiles, effective configuration, download history, environment checks, and maintenance actions.

GET /api/profiles

Show the named credential profiles configured per service (usable as the profile parameter elsewhere). The response holds only services whose credentials are a mapping of profile name to credential. It leaves out services with a single unnamed credential. Your allowlist filters the response.

{
  "profiles": {
    "EXAMPLE": ["default", "premium"],
    "OTHER": ["us-account"]
  }
}

GET /api/config

Return a read-only, redacted view of the effective server configuration, suitable for a settings page in a UI. The server never sends secrets: it masks every config key whose name looks like a secret (secret, password, passwd, token, api_key, credential, auth, cookie, bearer, private) and any userinfo in proxy URLs. The directories block holds the server's absolute paths and reaches only an admin key (admin: true or the api_secret); a plain key gets the response without it.

{
  "config": {
    "dl": { "...": "redacted default dl parameters" },
    "serve": {
      "max_concurrent_downloads": 2,
      "job_retention_hours": 24,
      "history_limit": 100,
      "services": null,
      "remote_only": false,
      "cdm_overrides": null,
      "allow_job_credentials": false
    },
    "directories": {
      "downloads": "/home/user/Downloads/unshackle",
      "temp": "/home/user/.unshackle/temp",
      "cache": "/home/user/.unshackle/cache"
    },
    "services": ["EXAMPLE", "OTHER"]
  }
}

GET /api/history

Read the persisted history of jobs that reached a terminal state, newest first. Each API key sees only the jobs it submitted, plus entries written before the history recorded an owner. The same rule applies to DELETE /api/history/{job_id} and POST /api/download/jobs/clear-finished. unshackle stores the history in api_history.jsonl in the cache directory. It skips corrupt lines, and a missing file yields an empty list.

Query parameters

Param Type Default Description
limit int (≥ 1) 100 Maximum entries to return.
service string - Case-insensitive service filter.
{
  "history": [
    {
      "job_id": "b0f7c8e2-...",
      "service": "EXAMPLE",
      "title_id": "12345",
      "title": "Example Show S01E01",
      "status": "completed",
      "created_time": "2026-07-03T12:00:00+00:00",
      "completed_time": "2026-07-03T12:08:00+00:00",
      "output_files": ["/downloads/Example.S01E01.mkv"],
      "skipped_titles": [],
      "already_present": [],
      "error_message": null,
      "parameters": { "...": "redacted" }
    }
  ],
  "count": 1
}
Status Error code Meaning
200 - History returned.
400 INVALID_PARAMETERS Invalid limit.

already_present lists completion-archive skips separately from newly produced output_files and missing-track skipped_titles. Each entry contains service, title_id, title, reason: "already_present", and variants (objects with quality, range, codec). The same field is present in job progress/details. A job with only archive matches completes successfully. The archive is independent of history retention, isolated per API key, and has no inventory endpoint.

DELETE /api/history/{job_id}

Remove a single persisted history entry. Returns 204 No Content (empty body) on success.

Status Error code Meaning
204 - Entry removed (empty body).
404 NOT_FOUND No such entry (or outside your allowlist).

POST /api/maintenance/clear-cache and POST /api/maintenance/clear-temp

Delete and recreate the cache or temp directory. Both, and refresh-services, need admin: true on the API key or the api_secret itself; any other key gets 403 FORBIDDEN. Neither takes a request body. The server blocks both with 409 CONFLICT if any job is currently downloading (the details include the offending active_jobs).

The 409 guard is about active file I/O, not an arbitrary lock. An in-flight job may still be reading cached title data under the cache directory, and active download workers are writing segment files under temp. The removal of either directory mid-download would corrupt those jobs, so the endpoints refuse while a download is in progress.

clear-cache also wipes download history

The persistent history read by GET /api/history lives in api_history.jsonl inside the cache directory. Because clear-cache deletes and recreates that whole directory, calling it also erases your entire download history, not only cached title data. If you want to keep history, do not clear the cache. Remove individual entries with DELETE /api/history/{job_id} instead.

{ "cleared": true, "freed_bytes": 1048576 }
Status Error code Meaning
200 - Directory cleared.
409 CONFLICT A download is currently active.

POST /api/maintenance/refresh-services

git-pull every service repository configured under directories.services and re-import the services that changed, without a restart. refreshed becomes true when all repos updated successfully, or when you configure no repository. deferred lists the services that have a running or queued job: they keep their current code until that job finishes, then swap. load_errors lists the services whose new code failed to import; the server drops them until the next successful refresh.

{
  "refreshed": true,
  "repos": [
    {
      "spec": "github.com/example/services",
      "updated": true,
      "changes": ["~EXAMPLE", "+EXAMPLE2"],
      "deferred": ["EXAMPLE"],
      "load_errors": []
    }
  ]
}

GET /api/env/check

Report the install status of the external binaries unshackle depends on (the same set unshackle env check inspects), with best-effort version detection.

{
  "checks": [
    { "name": "ffmpeg", "installed": true, "version": "6.1.1", "required": true },
    { "name": "ccextractor", "installed": false, "version": null, "required": false }
  ]
}

Remote sessions

The /api/session/* and /api/tunnel routes carry the remote sessions of dl --remote. The remote session protocol page is their reference: each route, its request and response, the login states, the licensing modes and the error codes.

Remote services relay

A full-mode server can run a service through one of its own remote_services servers. GET /api/config lists their names in remote_services, and GET /api/services?remote=<name> lists the services of that server, each with remote set to the name. Add "remote": "<name>" to POST /api/search, /api/list-titles, /api/list-tracks or /api/download, and the server opens a remote session with its own API key for that server: the remote server logs in and resolves titles, tracks and licences, and a download still runs, decrypts and muxes here. The tag may be any case or an alias, and your allowlist applies to it. A --remote-only server does not relay.

  • An unknown name is 400 INVALID_PARAMETERS, a server that does not answer is SERVICE_UNAVAILABLE, a server that rejects the API key of this server is AUTH_FAILED (424), and a tag that it does not offer is INVALID_SERVICE.
  • List calls from the same API key for the same title, profile, proxy, client region and service options share one remote session, which closes after 120 seconds unused.
  • When the server stops, a list call that waits on the login of a new remote session, or starts one, gets SERVER_DRAINING (409). A call that opens a lost remote session again can be cut too: list-titles then gets SERVER_DRAINING, and list-tracks that or SERVICE_ERROR (422).
  • An optional client_name names your client on the dashboard of the remote server as serve (<client_name>).
  • A relayed search opens no remote session. The server sends its own credentials, cookies and cache for the profile with the search. A service that searches with no login gets none of them.

A remote login that waits on you (a pair code or URL to approve on another device, or a question such as an OTP) cannot answer through a list call. Poll GET /api/remote/logins beside it. A remote download job shows the same text as its own notice, and asks a question through input_prompt as a local job does.

GET /api/remote/logins

The logins of your list calls that wait on a remote server. An admin key sees the logins of every API key.

{
  "logins": [
    {
      "id": "3f2a9c...",
      "remote": "my_server",
      "service": "EXAMPLE",
      "title_id": "0ABCDEF",
      "prompt": null,
      "notice": "Open https://example.com/activate and enter ABCD-1234",
      "qr": "https://example.com/activate?code=ABCD-1234"
    }
  ]
}
Field Description
id The ID to answer the prompt with.
remote, service, title_id The remote server, the service and the title of the list call.
prompt What the login asks you (an OTP, a PIN), or null.
notice What the login shows you while it waits, such as a URL and a pair code, or null.
qr The text of a QR code to scan with the prompt or notice, or null.

POST /api/remote/logins/{login_id}/input

Answer the prompt of a remote login. Body: { "response": "..." } (required).

{ "status": "accepted" }
Status Error code Meaning
200 - Answer accepted.
400 INVALID_INPUT No response.
404 NOT_FOUND No such remote login for this API key.
409 CONFLICT The login asks nothing now.

Error responses

The server serialises every structured error raised inside a handler to the same JSON envelope:

{
  "status": "error",
  "error_code": "INVALID_PARAMETERS",
  "message": "Invalid video codec: XYZ",
  "timestamp": "2026-07-03T12:00:00+00:00",
  "details": { "field": "vcodec" },
  "retryable": true,
  "debug_info": { "exception_type": "APIError", "traceback": "..." }
}
  • details appears only when non-empty.
  • retryable appears only when the error is retryable (e.g. network errors, rate limiting).
  • debug_info appears only when you start the server with --debug-api.

Authentication errors differ

Errors raised by the API-key middleware use a distinct shape ({"status": 401, "message": "Secret Key is Empty."}, {"status": 401, "message": "Secret Key is Invalid."}, or {"status": 429, "message": "Rate limit exceeded."} with a Retry-After header) with an integer status and no error_code, timestamp, or details. A 429 from the middleware therefore carries no error_code, unlike the RATE_LIMITED code below, which a handler raises for a rate limit the service imposed. A malformed JSON body on any POST, by contrast, returns the standard envelope with error_code: "INVALID_INPUT".

Error codes and default status

The error code catalogue gives the default HTTP status of each error code.

When a generic (uncategorised) exception reaches a handler, unshackle inspects its message and type to pick a code. For example, messages mentioning "connection" or "timeout" become NETWORK_ERROR (424, retryable), "rate limit" or "429" become RATE_LIMITED (429, retryable), and anything unrecognised collapses to INTERNAL_ERROR (422).


See also