Media API
Media endpoints manage the workspace media library. Each saved item has anid you can reference when you create or update a post, or in comment media.
All routes require the posts ability (same token scope as post CRUD).
Using media on posts
Incontent[].media, each element may be either:
- Integer - library
idfrom list, get,upload/file, orupload/url(must belong to the sameworkspace_idas the post). - String (URL) - public HTTPS link to an image, video, or document. The API downloads the file into your media library when the post is saved, so the post never depends on your link staying up (signed or expiring links are fine). Dropbox and Google Drive share links work as they are when the file is shared so anyone with the link can view it. A URL that can’t be downloaded, isn’t an allowed type, is over 500 MB, or takes longer than 75 seconds is refused with
422naming it, and no post is created.
media array.
Supported file types
Documents
A document attachment becomes a LinkedIn document post (the swipeable carousel). Two rules apply when publishing:- LinkedIn accepts one document per post. If you attach several, only the first is published.
- The document must be the first item in
content[].media. PostSyncer decides the post type from the first attachment, so a document listed after an image or video is dropped - LinkedIn cannot mix documents with other media.
media - comments remain image and video only.
Typical flows:
- File on disk →
POST /media/upload/filewith the file → readmedia.id→ include that id inPOST /posts…content[].media. - Already on the web → either paste the URL directly in
content[].media, or callPOST /media/upload/urlfirst to store a copy in the library and then use the returnedid. - Browse library →
GET /media?workspace_id=…to discover ids.
Limits and infrastructure
- File upload is limited to 500MB per request.
- URL import may return multiple
mediaobjects for a single input URL (e.g. some social posts). Checkcount_storedand each item’sid.
Folders
Create and list folders with Folders API, then passfolder_id on upload endpoints to file media into the right library folder. Use folder_id or root_only on List media to scope results.