# API routes and scopes

> Every route of the Social Crawl API with its method, path and the token scopes that may call it. Made from the controllers, so it matches the code.

Source: https://crawl-docs.pdhq.win/advanced/api-routes/
Last updated: 2026-12-02

The API is a NestJS application. This page lists all 141 routes. **It is generated** from the controllers by `yarn workspace @social-crawl/docs routes`, so a route that exists in the code is in this table.

## Authentication

Every route needs a bearer token (`Authorization: Bearer <token>`) unless the table says public. A token has a **scope**:

| Scope | How you get it | Lifetime | What it may do |
| --- | --- | --- | --- |
| `web` | `POST /auth/login` with the password | 7 days | Everything that lists `web`, which is every route without a `Scopes` decorator. |
| `capture` | `POST /auth/extension-token` (needs a `web` token) | 180 days | Only the routes that list `capture`: saving a post, looking one up, and sending videos. It cannot read or delete a library. |
| restricted | `POST /auth/unlock` with the second password | 12 hours | Not a login token. It is sent in the header `x-restricted-token` with a `web` token to see the restricted part. |

A route with no `@Scopes` accepts `web` only. A wrong scope answers **403**, a missing token **401**.

The web app does not expose these routes to the browser directly. It keeps the token in an `httpOnly` cookie and forwards only an allowlist of routes through `/api/...`. See [Architecture](https://crawl-docs.pdhq.win/advanced/architecture.md).

The temporary share links people open (`/s/<secret>/...`) are pages of the **web app**. They read the **public** routes `/share/:token/...` and `/share-collection/:token/...` below, which need no token because the secret in the address is the key. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md).

Bodies are JSON up to 20 MB. Cross-origin calls are allowed only from the origins in `CORS_ORIGINS`.

## Attachments

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/bookmarks/:id/attachments` | web | `attachments.controller.ts` `list` |
| GET | `/attachments/title` | web | `attachments.controller.ts` `title` |
| POST | `/bookmarks/:id/attachments/posts` | web | `attachments.controller.ts` `posts` |
| POST | `/bookmarks/:id/attachments/link` | web | `attachments.controller.ts` `link` |
| POST | `/bookmarks/:id/attachments/file` | web | `attachments.controller.ts` `file` |
| GET | `/bookmarks/:id/attachments/:attachmentId/file` | web | `attachments.controller.ts` `download` |
| DELETE | `/bookmarks/:id/attachments/:attachmentId` | web | `attachments.controller.ts` `remove` |

## Big videos: upload, join, convert

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/big-uploads/limits` | web, capture | `big-uploads.controller.ts` `limits` |
| GET | `/big-uploads` | web, capture | `big-uploads.controller.ts` `list` |
| POST | `/big-uploads` | web, capture | `big-uploads.controller.ts` `start` |
| POST | `/big-uploads/sweep` | web, capture | `big-uploads.controller.ts` `sweep` |
| GET | `/big-uploads/:id` | web, capture | `big-uploads.controller.ts` `get` |
| GET | `/big-uploads/:id/file` | web, capture | `big-uploads.controller.ts` `file` |
| GET | `/big-uploads/:id/one` | web, capture | `big-uploads.controller.ts` `one` |
| POST | `/big-uploads/:id/join` | web, capture | `big-uploads.controller.ts` `join` |
| DELETE | `/big-uploads/:id/join` | web, capture | `big-uploads.controller.ts` `stopJoin` |
| DELETE | `/big-uploads/:id/one` | web, capture | `big-uploads.controller.ts` `removeOne` |
| GET | `/big-uploads/:id/joined` | web, capture | `big-uploads.controller.ts` `joined` |
| POST | `/big-uploads/:id/parts/:n/pieces/:i` | web, capture | `big-uploads.controller.ts` `piece` |
| POST | `/big-uploads/:id/parts/:n/abort` | web, capture | `big-uploads.controller.ts` `abortPart` |
| POST | `/big-uploads/:id/finish` | web, capture | `big-uploads.controller.ts` `finish` |
| POST | `/big-uploads/:id/link` | web, capture | `big-uploads.controller.ts` `link` |
| POST | `/big-uploads/:id/check` | web, capture | `big-uploads.controller.ts` `startCheck` |
| GET | `/big-uploads/:id/check` | web, capture | `big-uploads.controller.ts` `checkJob` |
| POST | `/big-uploads/:id/check/stop` | web, capture | `big-uploads.controller.ts` `stopCheck` |
| DELETE | `/big-uploads/:id` | web, capture | `big-uploads.controller.ts` `remove` |
| GET | `/big-uploads/:id/convert` | web | `convert.controller.ts` `status` |
| POST | `/big-uploads/:id/convert` | web | `convert.controller.ts` `offer` |
| POST | `/big-uploads/:id/convert/go` | web | `convert.controller.ts` `go` |
| POST | `/big-uploads/:id/convert/own` | web | `convert.controller.ts` `attachOwn` |
| DELETE | `/big-uploads/:id/convert` | web | `convert.controller.ts` `stop` |
| POST | `/big-uploads/:id/convert/remove-raw` | web | `convert.controller.ts` `removeRaw` |
| GET | `/big-uploads/:id/converting` | web | `convert.controller.ts` `live` |
| GET | `/big-uploads/:id/converted` | web | `convert.controller.ts` `copy` |
| GET | `/convert-queue` | web | `convert.controller.ts` `queue` |

## Capture: uploads and fetches by the extension

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| POST | `/capture/fetches` | web, capture | `fetches.controller.ts` `start` |
| GET | `/capture/fetches/:id` | web, capture | `fetches.controller.ts` `get` |
| POST | `/capture/uploads` | web, capture | `uploads.controller.ts` `create` |
| POST | `/capture/uploads/:id/pieces/:index` | web, capture | `uploads.controller.ts` `append` |
| POST | `/capture/uploads/:id/done` | web, capture | `uploads.controller.ts` `finish` |
| DELETE | `/capture/uploads/:id` | web, capture | `uploads.controller.ts` `release` |

## Database copy and delete

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/settings/database` | web | `database-migration.controller.ts` `status` |
| POST | `/settings/database/check` | web | `database-migration.controller.ts` `check` |
| POST | `/settings/database/copy` | web | `database-migration.controller.ts` `copy` |
| POST | `/settings/database/cancel` | web | `database-migration.controller.ts` `cancel` |
| GET | `/settings/database/old` | web | `old-database.controller.ts` `status` |
| POST | `/settings/database/old/check` | web | `old-database.controller.ts` `check` |
| POST | `/settings/database/old/delete` | web | `old-database.controller.ts` `delete` |

## Health

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/health` | none (public) | `health.controller.ts` `check` |

## Layouts

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/layouts` | web | `layouts.controller.ts` `list` |
| POST | `/layouts` | web | `layouts.controller.ts` `create` |
| PUT | `/layouts/:id` | web | `layouts.controller.ts` `update` |
| DELETE | `/layouts/:id` | web | `layouts.controller.ts` `remove` |

## Posts (bookmarks)

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| POST | `/posts/preview` | web | `bookmarks.controller.ts` `preview` |
| POST | `/bookmarks` | web | `bookmarks.controller.ts` `create` |
| POST | `/capture` | web, capture | `bookmarks.controller.ts` `capture` |
| GET | `/capture/lookup` | web, capture | `bookmarks.controller.ts` `lookup` |
| GET | `/bookmarks` | web | `bookmarks.controller.ts` `list` |
| GET | `/bookmarks/:id` | web | `bookmarks.controller.ts` `get` |
| PATCH | `/bookmarks/:id` | web | `bookmarks.controller.ts` `update` |
| DELETE | `/bookmarks/:id/media/:mediaId` | web | `bookmarks.controller.ts` `removeMedia` |
| POST | `/bookmarks/:id/media/:mediaId/file` | web, capture | `bookmarks.controller.ts` `attachUpload` |
| POST | `/bookmarks/:id/media/:mediaId/prepare` | web | `bookmarks.controller.ts` `prepareMedia` |
| POST | `/bookmarks/:id/media/:mediaId/renditions` | web | `bookmarks.controller.ts` `requestRendition` |
| DELETE | `/bookmarks/:id/media/:mediaId/renditions/:height` | web | `bookmarks.controller.ts` `removeRendition` |
| POST | `/bookmarks/:id/media/:mediaId/captions` | web | `bookmarks.controller.ts` `addCaption` |
| GET | `/settings/speech` | web | `bookmarks.controller.ts` `speech` |
| POST | `/bookmarks/:id/media/:mediaId/transcript` | web | `bookmarks.controller.ts` `requestTranscript` |
| DELETE | `/bookmarks/:id/media/:mediaId/transcript` | web | `bookmarks.controller.ts` `removeTranscript` |
| DELETE | `/bookmarks/:id/media/:mediaId/captions` | web | `bookmarks.controller.ts` `removeCaption` |
| GET | `/bookmarks/:id/media-jobs` | web | `bookmarks.controller.ts` `mediaJobsOf` |
| DELETE | `/bookmarks/:id` | web | `bookmarks.controller.ts` `remove` |
| GET | `/bookmarks/:id/download` | web | `bookmarks.controller.ts` `download` |
| GET | `/bookmarks/:id/media/:mediaId/clip` | web | `bookmarks.controller.ts` `clip` |
| GET | `/bookmarks/:id/markdown` | web | `bookmarks.controller.ts` `markdown` |
| GET | `/bookmarks/:id/files/*path` | web | `bookmarks.controller.ts` `file` |
| GET (stream) | `/events` | web | `events.controller.ts` `stream` |
| POST | `/auth/unlock` | web | `restricted.controller.ts` `unlock` |
| GET | `/restricted` | web | `restricted.controller.ts` `status` |
| GET | `/restricted/bookmarks` | web | `restricted.controller.ts` `list` |
| POST | `/restricted/bookmarks/:id` | web | `restricted.controller.ts` `restrict` |
| DELETE | `/restricted/bookmarks/:id` | web | `restricted.controller.ts` `unrestrict` |
| GET | `/restricted/rules` | web | `restricted.controller.ts` `rules` |
| POST | `/restricted/rules` | web | `restricted.controller.ts` `addRule` |
| DELETE | `/restricted/rules/:id` | web | `restricted.controller.ts` `removeRule` |

## Save YouTube from a link (experiment)

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/yt-link/status` | web | `yt-link.controller.ts` `status` |
| GET | `/yt-link/log` | web | `yt-link.controller.ts` `log` |
| POST | `/yt-link/probe` | web | `yt-link.controller.ts` `probe` |
| POST | `/yt-link/doctor` | web | `yt-link.controller.ts` `doctor` |
| GET | `/yt-link/jobs` | web | `yt-link.controller.ts` `jobs` |
| POST | `/yt-link/jobs` | web | `yt-link.controller.ts` `add` |
| GET | `/yt-link/jobs/:id` | web | `yt-link.controller.ts` `job` |
| POST | `/yt-link/jobs/:id/cancel` | web | `yt-link.controller.ts` `cancel` |
| POST | `/yt-link/jobs/:id/retry` | web | `yt-link.controller.ts` `retry` |
| POST | `/yt-link/jobs/:id/discard` | web | `yt-link.controller.ts` `discard` |
| DELETE | `/yt-link/jobs/:id` | web | `yt-link.controller.ts` `forget` |

## Settings

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/settings/video` | web | `settings.controller.ts` `video` |
| PUT | `/settings/video` | web | `settings.controller.ts` `saveVideo` |

## Share links

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| POST | `/collection-shares` | web | `collection-shares.controller.ts` `create` |
| GET | `/collection-shares` | web | `collection-shares.controller.ts` `list` |
| POST | `/collection-shares/:shareId/extend` | web | `collection-shares.controller.ts` `extend` |
| DELETE | `/collection-shares/:shareId` | web | `collection-shares.controller.ts` `remove` |
| GET | `/share-collection/:token/p/:n/files/*path` | none (public) | `collection-shares.controller.ts` `file` |
| GET | `/share-collection/:token/p/:n/download` | none (public) | `collection-shares.controller.ts` `downloadOne` |
| GET | `/share-collection/:token/download` | none (public) | `collection-shares.controller.ts` `downloadAll` |
| GET | `/share-collection/:token/markdown` | none (public) | `collection-shares.controller.ts` `markdown` |
| GET | `/share-collection/:token/posts` | none (public) | `collection-shares.controller.ts` `posts` |
| POST | `/bookmarks/:id/shares` | web | `shares.controller.ts` `create` |
| GET | `/bookmarks/:id/shares` | web | `shares.controller.ts` `list` |
| POST | `/bookmarks/:id/shares/:shareId/extend` | web | `shares.controller.ts` `extend` |
| DELETE | `/bookmarks/:id/shares/:shareId` | web | `shares.controller.ts` `remove` |
| GET | `/share/:token` | none (public) | `shares.controller.ts` `meta` |
| GET | `/share/:token/files/*path` | none (public) | `shares.controller.ts` `file` |
| GET | `/share/:token/download` | none (public) | `shares.controller.ts` `download` |

## Sign-in and tokens

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| POST | `/auth/login` | none (public) | `auth.controller.ts` `login` |
| POST | `/auth/extension-token` | web | `auth.controller.ts` `extensionToken` |

## The extension download

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/extension/download` | web | `extension.controller.ts` `download` |

## The lab (testing only)

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/lab/status` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `status` |
| POST | `/lab/probe` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `probe` |
| POST | `/lab/generated` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `generated` |
| GET | `/lab/jobs/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `job` |
| POST | `/lab/jobs/:id/stop` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `stop` |
| POST | `/lab/discard` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `discard` |
| POST | `/lab/uploads` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `create` |
| GET | `/lab/uploads/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `state` |
| POST | `/lab/uploads/:id/parts/:n/pieces/:i` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `piece` |
| POST | `/lab/uploads/:id/parts/:n/abort` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `abortPart` |
| POST | `/lab/uploads/:id/finish` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `finish` |
| POST | `/lab/uploads/:id/verify` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `verify` |
| DELETE | `/lab/uploads/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `remove` |
| POST | `/lab/sweep` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `sweep` |
| DELETE | `/lab/all` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `removeAll` |

## The queue

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/jobs` | web | `jobs.controller.ts` `list` |

## WebDAV and storage places

| Method | Path | Scopes | Handler |
| --- | --- | --- | --- |
| GET | `/settings/webdav` | web | `webdav.controller.ts` `view` |
| PUT | `/settings/webdav` | web | `webdav.controller.ts` `save` |
| POST | `/settings/webdav/test` | web | `webdav.controller.ts` `test` |
| POST | `/bookmarks/:id/webdav/copy` | web | `webdav.controller.ts` `copy` |
| POST | `/bookmarks/:id/webdav/move-large` | web | `webdav.controller.ts` `moveLarge` |
| GET | `/settings/storage` | web | `webdav.controller.ts` `names` |
| GET | `/bookmarks/:id/storage` | web | `webdav.controller.ts` `location` |
| POST | `/bookmarks/:id/storage/keep` | web | `webdav.controller.ts` `keep` |
