Document (PDF) post
Post a PDF to LinkedIn as a swipeable document carousel. Upload, poll until processing finishes, then create the post.
A document post turns a PDF into the swipeable "document" carousel you see on LinkedIn. The flow is init → upload → poll → create — the extra poll step is what makes documents different: LinkedIn rasterizes each page into preview images before the file can be posted.
When to use
You're posting a PDF (a deck, one-pager, guide) that should render as a swipeable carousel.
Steps
POST /posts/upload/initwithmediaType: "document"→assetUrn,uploadUrl,recipes.PUTthe PDF bytes touploadUrl.- Poll
GET /posts/upload/document-status?assetUrn=…untilready: true. POST /posts/createwithmediaType: "document", theassetUrn,recipes, and atitle.
Don't skip the poll. If you call
createbefore the document isREADY, the post won't have its pages.
# 1. init -> assetUrn, uploadUrl, recipescurl -X POST https://api.connectsafely.ai/linkedin/posts/upload/init -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{ "mediaType": "document", "fileSize": 184230, "filename": "deck.pdf" }'
# 2. upload the PDFcurl -X PUT "PASTE_uploadUrl" -H "Content-Type: application/pdf" --data-binary @deck.pdf
# 3. poll until ready:true (repeat every couple seconds; URL-encode the assetUrn)curl "https://api.connectsafely.ai/linkedin/posts/upload/document-status?assetUrn=PASTE_urlencoded_assetUrn" -H "Authorization: Bearer YOUR_API_KEY"# -> { "success": true, "status": "READY", "ready": true }
# 4. createcurl -X POST https://api.connectsafely.ai/linkedin/posts/create -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{ "mediaType": "document", "assetUrn": "PASTE_assetUrn", "recipes": ["PASTE_recipe"], "title": "Our 2026 Product Roadmap", "text": "The full roadmap as a swipeable doc." }'Fields
| Field | Required | Notes |
|---|---|---|
mediaType | yes | "document". |
assetUrn | yes | From upload/init. |
recipes | yes | From upload/init. |
title | recommended | The document title shown on the post. Defaults to empty if omitted. |
text | yes | The post body above the document. |
Common mistakes
- Creating before
ready: true. The post will be missing its pages. Always poll first. - Skipping
recipes. Pass therecipesarray returned byupload/init. - Not URL-encoding
assetUrnin the status query string.
Reference
Video post
Upload and publish a video to LinkedIn. Covers single-shot upload for small videos and chunked (multipart) upload for large ones.
LinkedIn Profiles API
Retrieve enriched LinkedIn profile data via API. Get work history, skills, education, and contact information for lead enrichment and CRM sync.
