# LinkedIn API publishing guide: text, images, and 100 MB PDF carousels

Human page: https://pubnio.com/blog/linkedin-api-publishing-pdf-carousels
Published: 2026-12-01
Category: Platform guides

## Direct answer

LinkedIn swipeable document carousels are published as native PDF assets (up to 100 MB and 300 pages) registered via LinkedIn's Documents API before creating a post referencing the returned document URN. PubNio automates PDF staging, URN registration, 3,000-character preflight checks, and OAuth token refresh.

## 1. Why PDF document posts outperform link posts on LinkedIn

Native swipeable PDF carousels keep readers inside the LinkedIn feed without outbound link throttling. Through the raw LinkedIn REST API, publishing one requires initializing a document upload, streaming the PDF binary to LinkedIn's upload URL, waiting for document processing, and referencing the resulting urn:li:document asset in a Posts API payload.

PubNio handles the multi-step upload automatically whenever you attach a staged application/pdf asset up to 100 MB to a LinkedIn target.

```
const deck = await ws.media.importUrl({
  url: "https://cdn.example.com/q4-architecture-slides.pdf",
});

const draft = await ws.posts.create({
  isDraft: true,
  title: "Q4 Architecture Slides",
  text: "Seven lessons from building idempotent multi-platform publishing.",
  targets: [
    {
      accountId: linkedinAccountId,
      placement: "document",
      media: [{ mediaId: deck.mediaId }],
    },
  ],
});

await ws.posts.publish(draft.postId, { idempotencyKey: "li-deck-q4" });
```

## 2. Avoiding silent 60-day LinkedIn token expiry

LinkedIn member OAuth access tokens expire after 60 days. PubNio tracks token expiry metadata and returns the typed account_token_expired error during preflight validation so you can prompt a one-click reconnect before a launch post misses its slot.
