Facebook Pixel
APICreating Posts

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

  1. POST /posts/upload/init with mediaType: "document"assetUrn, uploadUrl, recipes.
  2. PUT the PDF bytes to uploadUrl.
  3. Poll GET /posts/upload/document-status?assetUrn=… until ready: true.
  4. POST /posts/create with mediaType: "document", the assetUrn, recipes, and a title.

Don't skip the poll. If you call create before the document is READY, the post won't have its pages.

Document post (full flow)
# 1. init -> assetUrn, uploadUrl, recipes
curl -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 PDF
curl -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. create
curl -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

FieldRequiredNotes
mediaTypeyes"document".
assetUrnyesFrom upload/init.
recipesyesFrom upload/init.
titlerecommendedThe document title shown on the post. Defaults to empty if omitted.
textyesThe post body above the document.

Common mistakes

  • Creating before ready: true. The post will be missing its pages. Always poll first.
  • Skipping recipes. Pass the recipes array returned by upload/init.
  • Not URL-encoding assetUrn in the status query string.

Reference