# LinkedIn documents publishing API

A LinkedIn document post is one PDF, attached as the only media item on a feed post and named with `documentTitle`. LinkedIn's rules below were read 2026-12-05.

## Rules for LinkedIn documents

| Rule | Value |
| --- | --- |
| Placement | `feed` |
| Media | document |
| Items per post | 1 PDF |
| Caption limit | 3,000 characters |

- A document post carries exactly one PDF and no other media.
- A PDF needs a `documentTitle`, and a post without a PDF cannot carry one.

| Fact | Value | Their words | Source |
| --- | --- | --- | --- |
| Document size | 100MB and 300 pages | "The file size can't exceed 100MB and 300 pages." | [Documents API](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/documents-api), read 2026-12-05 |
| Post text (characters) | 3,000 | "The maximum length of the text of a UGC Post is 3,000 characters." | [UGC Post API (legacy)](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/ugc-post-api), read 2026-12-05 |

## Settings

Set these under the target's `settings`. All are optional unless marked required.

| Field | What it does |
| --- | --- |
| `poll` | A poll; send text and no media, `altText`, or `documentTitle`. |
| `firstComment` | A comment PubNio posts under the published post. |
| `thread` | Up to 24 comments posted on the post. |
| `visibility` | `PUBLIC` or `CONNECTIONS`. |
| `altText` | Alt text for images, up to 4,086 characters. |
| `documentTitle` | The title shown on the document. Required with a PDF. |

## Publish request

One PDF, posted publicly with a document title.

```http
POST /api/v1/posts?workspaceId=4e5f6a7b-8c9d-4e0f-9a1b-2c3d4e5f6a7b
Authorization: Bearer pn_live_***
Idempotency-Key: linkedin-document-report
Content-Type: application/json

{
  "text": "Our 2026 delivery report, twelve pages.",
  "publishNow": true,
  "targets": [
    {
      "accountId": "7f3c2a10-5b4e-4d6f-8a9b-0c1d2e3f4a5b",
      "provider": "linkedin",
      "placement": "feed",
      "settings": {
        "visibility": "PUBLIC",
        "documentTitle": "2026 delivery report"
      },
      "media": [
        {
          "mediaId": "2d6e8f10-3a5b-4c7d-9e1f-a2b3c4d5e6f7"
        }
      ]
    }
  ]
}
```

## Limits

- A media URL fails with `media_upload_required`: import the file into the workspace from its URL, or send up to 8 MiB inline, then pass its `mediaId` to the target.

## Sources

- [Documents API](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/documents-api), read 2026-12-05
- [UGC Post API (legacy)](https://learn.microsoft.com/en-us/linkedin/marketing/community-management/shares/ugc-post-api), read 2026-12-05

## Related

- [LinkedIn publishing API](https://pubnio.com/platforms/linkedin)
- [LinkedIn MCP server](https://pubnio.com/linkedin-mcp)
- [LinkedIn network guide](https://pubnio.com/docs/networks/linkedin/)
- [LinkedIn error codes](https://pubnio.com/docs/errors/linkedin/)
- [LinkedIn rate limits](https://pubnio.com/docs/providers/linkedin/limits/)
- [LinkedIn media specs](https://pubnio.com/docs/providers/linkedin/media/)
- [LinkedIn OAuth scopes](https://pubnio.com/docs/providers/linkedin/scopes/)
- [LinkedIn token lifetimes](https://pubnio.com/docs/providers/linkedin/tokens/)
- [LinkedIn app review](https://pubnio.com/docs/providers/linkedin/app-review/)
- [LinkedIn API quota](https://pubnio.com/docs/providers/linkedin/quota/)
- [LinkedIn API versions](https://pubnio.com/docs/providers/linkedin/versioning/)
- [Rules for every placement](https://pubnio.com/docs/capabilities/)
- [All platforms](https://pubnio.com/platforms)

