Deployed 87b58190 with MkDocs version: 1.6.1

This commit is contained in:
2026-12-05 03:00:15 +00:00
parent 56cac92f20
commit 6ed040a6dd
44 changed files with 17665 additions and 13063 deletions
+232 -225
View File
@@ -13,10 +13,10 @@
<link rel="canonical" href="https://docs.unshackle.dev/dev/rest-api/quickstart/">
<link rel="prev" href="../">
<link rel="prev" href="../../service-architecture/">
<link rel="next" href="../authentication/">
<link rel="next" href="../endpoints/">
@@ -27,7 +27,7 @@
<title>Quick Start - unshackle</title>
<title>REST API Quick Start - unshackle</title>
@@ -116,7 +116,7 @@
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Quick Start
REST API Quick Start
</span>
</div>
@@ -347,28 +347,6 @@
<li class="md-tabs__item">
<a href="../../../reference/api/service/" class="md-tabs__link">
API Reference
</a>
</li>
</ul>
</div>
</nav>
@@ -614,6 +592,8 @@
@@ -886,6 +866,171 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3_9" >
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<span class="md-ellipsis">
Server
</span>
</a>
<label class="md-nav__link " for="__nav_3_9" id="__nav_3_9_label" tabindex="0">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_3_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3_9">
<span class="md-nav__icon md-icon"></span>
Server
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../guide/remote-sessions/" class="md-nav__link">
<span class="md-ellipsis">
Remote Sessions
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -1078,7 +1223,7 @@
<span class="md-ellipsis">
Output & Naming
Output & Naming Options
@@ -1162,7 +1307,7 @@
<span class="md-ellipsis">
Key Vaults
Key Vault Options
@@ -1282,6 +1427,8 @@
@@ -1400,14 +1547,6 @@
@@ -1436,9 +1575,8 @@
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" checked>
<div class="md-nav__link md-nav__container">
<a href="../" class="md-nav__link ">
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-ellipsis">
@@ -1452,14 +1590,8 @@
</a>
<label class="md-nav__link " for="__nav_5_3" id="__nav_5_3_label" tabindex="">
<span class="md-nav__icon md-icon"></span>
</label>
</div>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5_3">
@@ -1473,8 +1605,6 @@
<ul class="md-nav__list" data-md-scrollfix>
@@ -1497,7 +1627,7 @@
<span class="md-ellipsis">
Quick Start
REST API Quick Start
@@ -1515,7 +1645,7 @@
<span class="md-ellipsis">
Quick Start
REST API Quick Start
@@ -1608,10 +1738,10 @@
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#frequently-used-download-fields" class="md-nav__link">
<a href="#download-fields" class="md-nav__link">
<span class="md-ellipsis">
Frequently used download fields
Download fields
</span>
</a>
@@ -1693,34 +1823,6 @@
<li class="md-nav__item">
<a href="../authentication/" class="md-nav__link">
<span class="md-ellipsis">
Authentication
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../endpoints/" class="md-nav__link">
@@ -1778,14 +1880,14 @@
<li class="md-nav__item">
<a href="../dashboard/" class="md-nav__link">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Dashboard
Error Responses
@@ -1813,7 +1915,7 @@
<span class="md-ellipsis">
Remote Sessions
Remote Session Protocol
@@ -1827,55 +1929,20 @@
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../errors/" class="md-nav__link">
<span class="md-ellipsis">
Error Responses
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
@@ -1894,25 +1961,28 @@
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_6" >
<label class="md-nav__link" for="__nav_6" id="__nav_6_label" tabindex="0">
<li class="md-nav__item md-nav__item--section md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="">
<span class="md-ellipsis">
API Reference
Python API
@@ -1923,12 +1993,12 @@
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_6">
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
API Reference
Python API
</label>
@@ -2080,6 +2150,14 @@
</li>
</ul>
</nav>
</li>
</ul>
</nav>
@@ -2175,10 +2253,10 @@
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#frequently-used-download-fields" class="md-nav__link">
<a href="#download-fields" class="md-nav__link">
<span class="md-ellipsis">
Frequently used download fields
Download fields
</span>
</a>
@@ -2268,7 +2346,7 @@
<h1 id="rest-api-quick-start">REST API Quick Start<a class="headerlink" href="#rest-api-quick-start" title="Permanent link">&para;</a></h1>
<p>Unshackle ships with a built-in REST API that exposes the same download engine you drive from the command line. The <code>unshackle serve</code> command serves it and lets you queue downloads, poll their progress, browse services, and manage history over HTTP instead of the terminal.</p>
<p>The full loop runs end to end: start the server, authenticate, submit a download job, and poll it to completion. The <code>curl</code> commands here come directly from the API routes.</p>
<div class="admonition note">
<div class="admonition info">
<p class="admonition-title">Who this page is for</p>
<p>This is a <strong>developer</strong> guide. It assumes you are comfortable with HTTP, JSON, and a tool like <code>curl</code>. If you only want to download something, the <a href="../../../">command line</a> is simpler. The REST API is meant for building tools, UIs, and automation on top of unshackle.</p>
</div>
@@ -2362,7 +2440,7 @@
<tr>
<td><code>--remote-only</code></td>
<td>off</td>
<td>Expose only the remote-session subset of routes</td>
<td>Expose only the remote session routes: <code>/api/health</code>, <code>/api/services</code>, <code>/api/search</code>, <code>/api/session/*</code>, <code>/api/tunnel</code> and <code>/api/tunnel/check</code>, and the dashboard routes when <code>serve.dashboard.key</code> is set</td>
</tr>
<tr>
<td><code>--caddy</code></td>
@@ -2472,80 +2550,9 @@
</span><span id="__span-15-4"><a id="__codelineno-15-4" name="__codelineno-15-4" href="#__codelineno-15-4"></a><span class="w"> </span>-d<span class="w"> </span><span class="s1">'{"service":"EXAMPLE","title_id":"12345","quality":[1080]}'</span><span class="w"> </span><span class="se">\</span>
</span><span id="__span-15-5"><a id="__codelineno-15-5" name="__codelineno-15-5" href="#__codelineno-15-5"></a><span class="w"> </span><span class="p">|</span><span class="w"> </span>python<span class="w"> </span>-c<span class="w"> </span><span class="s2">"import sys, json; print(json.load(sys.stdin)['job_id'])"</span><span class="k">)</span>
</span></code></pre></div>
<h3 id="frequently-used-download-fields">Frequently used download fields<a class="headerlink" href="#frequently-used-download-fields" title="Permanent link">&para;</a></h3>
<p>The request body accepts the full download parameter set. A few of the most useful:</p>
<table>
<thead>
<tr>
<th>Field</th>
<th>Default</th>
<th>Meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>service</code></td>
<td>-</td>
<td>Service tag (required)</td>
</tr>
<tr>
<td><code>title_id</code></td>
<td>-</td>
<td>Title identifier (required)</td>
</tr>
<tr>
<td><code>profile</code></td>
<td><code>null</code></td>
<td>Named credential/cookie profile to use</td>
</tr>
<tr>
<td><code>quality</code></td>
<td><code>[]</code></td>
<td>Resolution(s), e.g. <code>[1080]</code>; empty means best available</td>
</tr>
<tr>
<td><code>vcodec</code></td>
<td><code>[]</code></td>
<td>Video codec, e.g. <code>"H265"</code></td>
</tr>
<tr>
<td><code>acodec</code></td>
<td><code>[]</code></td>
<td>Audio codec, e.g. <code>"EC3"</code></td>
</tr>
<tr>
<td><code>range</code></td>
<td><code>["SDR"]</code></td>
<td>Dynamic range: <code>SDR</code>, <code>HDR10</code>, <code>HDR10+</code>, <code>VIVID</code>, <code>DV</code>, <code>HLG</code>, <code>HYBRID</code></td>
</tr>
<tr>
<td><code>wanted</code></td>
<td><code>[]</code></td>
<td>Episodes to fetch, e.g. <code>["S01E01"]</code>, or music tracks, e.g. <code>["1-5"]</code>. Empty means all</td>
</tr>
<tr>
<td><code>lang</code></td>
<td><code>["orig"]</code></td>
<td>Video/audio language(s)</td>
</tr>
<tr>
<td><code>s_lang</code></td>
<td><code>["all"]</code></td>
<td>Subtitle language(s)</td>
</tr>
<tr>
<td><code>downloads</code></td>
<td><code>1</code></td>
<td>Number of tracks to download concurrently</td>
</tr>
<tr>
<td><code>proxy</code></td>
<td><code>null</code></td>
<td>Proxy URI or country code</td>
</tr>
</tbody>
</table>
<p>Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both <code>no_subs</code> and <code>subs_only</code>) come back as <code>400</code> with error code <code>INVALID_PARAMETERS</code>. See the full reference on the <a href="../endpoints/">download reference page</a> for every accepted field.</p>
<h3 id="download-fields">Download fields<a class="headerlink" href="#download-fields" title="Permanent link">&para;</a></h3>
<p>The request body takes every <code>dl</code> option. The <a href="../endpoints/#post-apidownload">request body table</a> gives the type, default and meaning of each field.</p>
<p>Validation is strict: invalid codecs, subtitle formats, dynamic-range names, non-positive counts, or flags that conflict (for example both <code>no_subs</code> and <code>subs_only</code>) come back as <code>400</code> with error code <code>INVALID_PARAMETERS</code>.</p>
<div class="admonition note">
<p class="admonition-title">Gated fields</p>
<p>The server refuses a per-request CDM (<code>cdm</code>) or inline credentials (<code>credential</code> / <code>credentials</code>) with <code>403 FORBIDDEN</code>, unless the server operator has explicitly opted in with <code>serve.cdm_overrides</code> and <code>serve.allow_job_credentials</code>. Both are off by default.</p>
@@ -2698,13 +2705,13 @@
<p>A retry reuses the original job's service, title, and parameters to enqueue a brand new job, and returns <code>202</code> with a fresh <code>job_id</code>. A retry works only on terminal jobs, and returns <code>409 CONFLICT</code> otherwise. A priority change works only on jobs still in the <code>queued</code> state.</p>
<hr />
<h2 id="beyond-a-single-download">Beyond a single download<a class="headerlink" href="#beyond-a-single-download" title="Permanent link">&para;</a></h2>
<p>The download loop above is the core of the API, but the same server exposes more:</p>
<p>The download flow above is the core of the API, but the same server exposes more:</p>
<ul>
<li><strong>Discovery</strong>: <code>POST /api/search</code> finds titles by query, and <code>POST /api/list-titles</code> / <code>POST /api/list-tracks</code> inspect what a title offers before you commit to downloading it. See <a href="../endpoints/">titles and tracks</a>.</li>
<li><strong>History</strong>: <code>GET /api/history</code> reads a persisted log of jobs that reached a terminal state (newest first), and <code>DELETE /api/history/{job_id}</code> removes a single entry. See <a href="../endpoints/">history</a>.</li>
<li><strong>Introspection</strong>: <code>GET /api/profiles</code> lists configured credential profiles per service, <code>GET /api/config</code> returns a redacted view of the effective server config, and <code>GET /api/env/check</code> reports which external binaries the machine has.</li>
<li><strong>Maintenance</strong>: <code>POST /api/maintenance/clear-cache</code>, <code>.../clear-temp</code>, and <code>.../refresh-services</code> do housekeeping (the server blocks the cache and temp clears with <code>409</code> while a download is active).</li>
<li><strong>Remote sessions</strong>: the <code>/api/session/*</code> endpoints drive the thin-client "remote download" flow, where the server authenticates and licenses on behalf of a local client. See <a href="../remote-sessions/">remote sessions</a>.</li>
<li><strong>Remote sessions</strong>: the routes that carry the remote sessions of <code>dl --remote</code>, where the server authenticates and licenses on behalf of a local client. See <a href="../remote-sessions/">remote sessions</a>.</li>
</ul>
<p>The interactive <strong>Swagger UI at <code>/api/docs/</code></strong> documents every route and lets you try them in the browser (send your <code>X-Secret-Key</code> there too).</p>
<hr />
@@ -2833,7 +2840,7 @@
<nav class="md-footer__inner md-grid" aria-label="Footer" >
<a href="../" class="md-footer__link md-footer__link--prev" aria-label="Previous: Overview">
<a href="../../service-architecture/" class="md-footer__link md-footer__link--prev" aria-label="Previous: Service Architecture">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
@@ -2843,20 +2850,20 @@
Previous
</span>
<div class="md-ellipsis">
Overview
Service Architecture
</div>
</div>
</a>
<a href="../authentication/" class="md-footer__link md-footer__link--next" aria-label="Next: Authentication">
<a href="../endpoints/" class="md-footer__link md-footer__link--next" aria-label="Next: Endpoints">
<div class="md-footer__title">
<span class="md-footer__direction">
Next
</span>
<div class="md-ellipsis">
Authentication
Endpoints
</div>
</div>
<div class="md-footer__button md-icon">