> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Media library

> Upload files or import links into a workspace's media library, then put them on posts by id or by link.

> [!NOTE]
>
> Each route needs its `media` permission: `media:read` to list, get, read download links or upload links, or analyze a video, `media:create` to upload, import or make an upload link, and `media:delete` to delete. Older keys with the legacy `posts` ability cover media too. See [Permissions](/docs/essentials/authentication.md#permissions).

Each file in a workspace's media library has an `id`. Put it in a post's `content[].media` when you [create](/docs/api-reference/posts/create.md) or [update](/docs/api-reference/posts/update.md) a post, or in a [comment's](/docs/api-reference/comments/create.md) `media`.

| Method | Path | What it does |
| - | - | - |
| GET | [`/media`](/docs/api-reference/media/list) | A page of the library, filtered by workspace, folder and source. |
| GET | [`/media/{media_id}`](/docs/api-reference/media/get) | One file. |
| DELETE | [`/media/{media_id}`](/docs/api-reference/media/delete) | Delete a file no upcoming post needs. |
| POST | [`/media/upload/file`](/docs/api-reference/media/upload-file) | Upload one file, up to 500 MB, on the upload host `https://upload.postsyncer.com/api/v1`. |
| POST | [`/media/upload/url`](/docs/api-reference/media/upload-url) | Import files from links: files, Dropbox and Google Drive share links, Unsplash, public social posts. |
| POST | [`/media/upload-links`](/docs/api-reference/media/upload-link) | Make a short-lived upload link: a page a person opens, with no sign-in, to drop files for an AI app that can't pass them. |
| GET | [`/media/upload-links/{upload_link_id}`](/docs/api-reference/media/upload-link-get) | Read an upload link: whether it expired, and the files it took. |
| POST | [`/media/download/url`](/docs/api-reference/media/download-url) | Read a public social post and get a download link for each of its files, without storing them. |
| POST | [`/media/analyze-video`](/docs/api-reference/media/analyze-video) | Watch a video with AI: what is said and shown, its hook, structure and key points. Paid plans. |

## Using media on posts

Each item of `content[].media` is either:

* **An id** of a file in the library (from a list, get, upload or import), in the post's workspace.
* **A link** (`https://`) to a picture, video or document. The file is copied into the library when the post is saved, so the post doesn't depend on your link staying up: signed and expiring links are fine. Dropbox and Google Drive share links work when anyone with the link can view the file. A link that can't be downloaded, isn't an allowed type, is over 500 MB or takes longer than 75 seconds is refused with `422` naming it, and no post is saved.

Ids and links can be mixed in one `media` list.

## Supported types

| Kind | Types | Publishes to |
| - | - | - |
| Picture | JPEG, PNG, GIF, WebP | Every network but YouTube. Google Business Profile takes JPEG and PNG only. |
| Video | MP4, MOV, WebM | MP4 goes to every network that takes video, and LinkedIn takes only MP4. MOV and WebM go to some networks. |
| Document | PDF, DOC, DOCX, PPT, PPTX | LinkedIn only |

MKV, AVI and other types are refused when they are uploaded or linked. [Types and limits](/docs/guides/media.md#types-and-limits) has what each network takes.

## Documents

A document becomes a LinkedIn document post (the swipeable carousel). Two rules apply when it is published:

* LinkedIn takes one document a post. With several, only the first is published.
* The document must be the first item in `content[].media`. PostSyncer picks the post's kind from the first file, so a document after a picture or video is dropped: LinkedIn can't mix them.

Other networks in the same post leave the document out and publish the text, with any picture or video they take. A comment's `media` takes no documents: only pictures and videos.

## Picture copies

A JPEG, PNG or WebP picture gets smaller copies a few seconds after it is saved, to show it without loading the whole file:

| Field | Size | Use it for |
| - | - | - |
| `thumb_url` | About 400 px on the long edge | Small cards and lists. On a video, its still, when PostSyncer has one. |
| `medium_url` | About 800 px on the long edge | Large tiles and previews. A picture no bigger than 800 px on its long edge has none: `url` is that small already. |

Each is left out until it is made, so use `url` when the one you want isn't there. These get none:

* GIFs, documents and links.
* Pictures over 50 MB, JPEGs over 50 megapixels, and PNG and WebP pictures over 20 megapixels. On an animated picture every frame counts.
* The copies PostSyncer makes of a picture to fit one network's rules.
* Copies of Google review photos.
* A file PostSyncer can't read as a picture.

Pictures saved before these copies existed have none until PostSyncer goes back over them. The copies go when the file does. Publishing always uses the original file.

## Folders

Make folders with [Create a folder](/docs/api-reference/folders/create.md), then send `folder_id` on an upload or import to file media there. [List media](/docs/api-reference/media/list.md) takes `folder_id` or `root_only` to show one folder, or the files in none.

## Related

* [Upload a file](/docs/api-reference/media/upload-file.md): a file on disk.
* [Import media from links](/docs/api-reference/media/upload-url.md): a file already on the web.
* [Create a post](/docs/api-reference/posts/create.md): where the `id` goes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.