# Post to LinkedIn from Claude Code

Turn CHANGELOG.md into a LinkedIn release post. Review the copy and destination in Claude Code, then use PubNio to publish and check the permalink.

Canonical page: https://pubnio.com/claude/linkedin

## Connect Claude Code

### Add PubNio to .mcp.json

Project scope. Commit it so everyone who opens the repository gets the same server, or run the claude mcp add command once instead.

```json
{
  "mcpServers": {
    "pubnio": {
      "type": "http",
      "url": "https://pubnio.com/mcp"
    }
  }
}
```

Or from a terminal:

```sh
claude mcp add --transport http pubnio https://pubnio.com/mcp
```

### Sign in

1. Start Claude Code in the project and run /mcp.
2. Select pubnio. A server from .mcp.json asks you to approve it first.
3. Authenticate. Your browser opens PubNio sign-in; approve the workspace and return to Claude Code.

### Install the skill (optional)

```sh
claude plugin marketplace add pubnio/agent-skills
claude plugin install pnio@pubnio
```

Installs the pnio skill as a Claude Code plugin from the pubnio/agent-skills marketplace.

### Connect your LinkedIn account

[Open PubNio](https://pubnio.com/app), choose your workspace, and go to Accounts. Use the same workspace when you sign in from Claude Code.

- Connect the LinkedIn member profile you want to post from in PubNio.
- Grant publishing access and check that the selected account is ready.
- Open the repository with the changelog in Claude Code.
- Confirm you have permission to publish to the selected profile in your workspace.

### Check the destination

```
List the LinkedIn accounts in my PubNio workspace. Show which member profiles are ready to publish. Do not create, schedule, or publish a post.
```

## Worked job: Turn your changelog into a LinkedIn release post

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

### Prompt

```
Read the newest entry in CHANGELOG.md and write a short LinkedIn announcement explaining what changed and who benefits. Find my ready LinkedIn member account in PubNio. If there is more than one, ask me which to use. Show me the draft and destination before posting. After I approve, publish a text post once and check the delivery status. Return the LinkedIn permalink when it is confirmed, or the PubNio post ID if delivery is still pending.
```

### What Claude Code runs: the Code Mode flow

```text
search   -> find the create-post and read-post operations
execute  -> create post { text: "…", publishNow: true, targets: [ { accountId: "…", provider: "linkedin", placement: "feed" } ] }
            Idempotency-Key: claude-linkedin-release-2026-12-04
         => 202 { postId, targets: [linkedin/feed: queued] }
execute  -> read post, sleep 1s between checks, within the 30s budget
         => { status: "published", url: "https://www.linkedin.com/feed/update/urn:li:share:123" }
```

### Settled result (200 OK)

```json
{
  "postId": "00000000-0000-4000-8000-000000000002",
  "isDraft": false,
  "revision": 1,
  "scheduledAt": null,
  "text": "This release makes scheduled posts easier to track. You can now check delivery for each connected account.",
  "media": [],
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "linkedin",
      "placement": "feed"
    }
  ],
  "deliveries": [
    {
      "targetId": "00000000-0000-4000-8000-000000000003",
      "attemptId": "00000000-0000-4000-8000-000000000004",
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "linkedin",
      "placement": "feed",
      "canRetry": false,
      "canReconcile": false,
      "revision": 1,
      "status": "published",
      "providerRef": {
        "id": "urn:li:share:123",
        "kind": "post"
      },
      "url": "https://www.linkedin.com/feed/update/urn:li:share:123"
    }
  ],
  "status": "published",
  "createdAt": "2026-12-04T07:20:00.000Z",
  "updatedAt": "2026-12-04T07:20:18.000Z"
}
```

### From approval to delivery

Illustrative conversation and result with sample data.

**Claude Code:** I found the LinkedIn member profile for Alex. Here’s the proposed text post:

This release makes scheduled posts easier to track. You can now check delivery for each connected account.

**You:** Approved. Publish it to Alex’s LinkedIn feed.

**Claude Code:** PubNio accepted the post. I checked that same post again, and its LinkedIn delivery now says published. Here’s the permalink from the confirmed delivery.

#### Example delivery result

- Status: `published`

- Destination: Alex’s LinkedIn feed

- Sample URL: `https://www.linkedin.com/feed/update/urn:li:share:123`

## Check delivery and get the link

- Save the PubNio post ID when the submission is accepted.
- Read the same post while its LinkedIn delivery is queued, submitting, or confirming.
- Once the delivery is published, return the LinkedIn URL from that delivery.
- If delivery is still pending, check the existing post again before resubmitting.

## LinkedIn rules Claude Code runs into

Account kinds: social account, social page. Connection scopes: `w_member_social`.

| Placement | Default | Media types | Max per target | Caption limit |
| --- | --- | --- | --- | --- |
| `feed` | Yes | image, video, document | 20 | 3,000 |

- A text release post can use the feed placement without a media attachment.
- The feed placement takes up to 20 images, videos, or documents.
- For a document post, combine slides into one application/pdf file.
- Keep PDF attachments within the 100 MB document limit.
- Commentary runs up to 3,000 characters.
- Stage any attachment and wait until it is ready before including it in a post.

## Failures and recovery

### LinkedIn issue codes

| Code | Cause | Fix | Retry |
| --- | --- | --- | --- |
| `account_not_ready` | The connected account's OAuth token is expired, revoked, or disconnected. | Reconnect the account in the PubNio workspace, then re-validate. | After reconnect |
| `caption_too_long` | Text exceeds the destination placement's character limit (`caption.limit`). | Shorten the caption or add a shorter target-specific text override. | No |
| `media_count` | Attached media count is below minimum or above the placement's maximum. | Adjust the `media` array (for example, 1 video for Reels/YouTube, 2–20 for carousels). | No |
| `media_mime_type` | File MIME type is rejected by the provider (for example, unsupported codec or container). | Convert to a supported MIME type (such as `image/jpeg`, `image/png`, `video/mp4`, or `application/pdf`). | No |
| `media_too_large` | Asset exceeds the provider's byte-size ceiling (such as 100 MB for LinkedIn PDFs). | Compress or trim the asset below the platform ceiling and re-import. | No |

### Claude Code setup problems

- /mcp lists pubnio as needing authentication. Select pubnio and authenticate again. PubNio answers an expired or revoked token with 401 and a sign-in challenge.
- Writes fail with 403 read_only_mode. PubNio returns 403 read_only_mode when the server URL ends in ?readOnly=1. Point the entry at https://pubnio.com/mcp to allow writes.

### Claude Code quirks

- Claude Code asks each person to approve a project server from .mcp.json before it connects.
- Sign-in starts inside a session from /mcp, not from a separate login command.

## What it won't do

- Attach more than one PDF to a document post.
- Read post analytics for a member profile. Analytics need a LinkedIn organization page.
- Connect accounts, create API keys, or manage webhooks from an MCP session that uses an API key. Those operations need a person signed in, so connect the MCP server with browser OAuth or use the PubNio web app.
- Stream binary uploads through execute. Import media from an HTTPS URL, or send a file of up to 8 MiB inline as base64.
- Run one execute call past 30 seconds or past its request limit. The script returns the post ID so the next call can check it.

## Frequently asked questions

### Can Claude Code post a text update to LinkedIn?

Yes. Connect the LinkedIn member profile in PubNio, then ask Claude Code to draft and publish to its feed.

### Can I attach a PDF release deck?

Yes. Use one ready PDF of up to 100 MB in the LinkedIn feed target.

### Does Claude Code need a separate API key?

Claude Code uses browser OAuth for PubNio MCP. The bearer token in the REST example is for direct API clients.

### How do I know the release post went live?

Ask Claude Code to read the existing post and return the permalink from the confirmed LinkedIn delivery.

### Should I commit .mcp.json with the PubNio entry?

Yes. The entry holds only the public URL https://pubnio.com/mcp. Each person approves the server and signs in from /mcp, so no token lands in the repository.

### Is there a PubNio plugin for Claude Code?

Yes. Run claude plugin marketplace add pubnio/agent-skills, then claude plugin install pnio@pubnio. The MCP server works without it.

## Also works with

- [Post to LinkedIn from Codex](https://pubnio.com/codex/linkedin)
- [Post to LinkedIn from Cursor](https://pubnio.com/cursor/linkedin)
- [Post to LinkedIn from OpenCode](https://pubnio.com/opencode/linkedin)
- [Post to Instagram from Claude Code](https://pubnio.com/claude/instagram)
- [Upload YouTube Shorts from Claude Code](https://pubnio.com/claude/youtube)
- [Post to a Facebook Page from Claude Code](https://pubnio.com/claude/facebook)
- [Create a Pinterest Pin from Claude Code](https://pubnio.com/claude/pinterest)
- [Post a TikTok video from Claude Code](https://pubnio.com/claude/tiktok)
- [Publish an X thread from Claude Code](https://pubnio.com/claude/x)
- [Claude Code setup](https://pubnio.com/claude)
- [LinkedIn publishing API](https://pubnio.com/platforms/linkedin)
- [LinkedIn MCP](https://pubnio.com/linkedin-mcp)
- [LinkedIn network reference](https://pubnio.com/docs/networks/linkedin/)
- [LinkedIn error codes](https://pubnio.com/docs/errors/linkedin/)
- [Pricing](https://pubnio.com/pricing)

## Get started with PubNio

Connect unlimited accounts at $0 per account. Pay as you go includes 50 free confirmed publishes a month on your first workspace, then $20 per 1,000. X API fees are separate.

## REST API reference

Contract example: sample IDs and URLs. The request and both responses decode against PubNio's API schemas; no provider confirmed this post.

```http
POST /api/v1/posts?workspaceId=00000000-0000-4000-8000-000000000006
Authorization: Bearer pn_live_***
Idempotency-Key: claude-linkedin-release-2026-12-04
Content-Type: application/json

{
  "text": "This release makes scheduled posts easier to track. You can now check delivery for each connected account.",
  "publishNow": true,
  "targets": [
    {
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "linkedin",
      "placement": "feed"
    }
  ]
}
```

### 202 Accepted

```json
{
  "postId": "00000000-0000-4000-8000-000000000002",
  "idempotencyKey": "claude-linkedin-release-2026-12-04",
  "targets": [
    {
      "targetId": "00000000-0000-4000-8000-000000000003",
      "attemptId": "00000000-0000-4000-8000-000000000004",
      "accountId": "00000000-0000-4000-8000-000000000001",
      "provider": "linkedin",
      "placement": "feed",
      "canRetry": false,
      "canReconcile": false,
      "status": "queued",
      "scheduledAt": null,
      "url": null,
      "issue": null
    }
  ],
  "warnings": []
}
```

