LinkedIn

Publish posts, images, and videos to LinkedIn via the PostPeer API.

Overview

Publish text posts, images, videos, and articles to LinkedIn personal profiles and company pages. PostPeer handles OAuth, token management, and LinkedIn's media upload process.

Quick Start

1. Connect a LinkedIn Account

curl https://api.postpeer.dev/v1/connect/linkedin \
  -H "x-access-key: YOUR_API_KEY"

Response:

{
  "url": "https://www.linkedin.com/oauth/v2/authorization?..."
}

Redirect the user to the url. After authorization, the account is connected to your project.

2. Get the Account ID

curl https://api.postpeer.dev/v1/connect/integrations \
  -H "x-access-key: YOUR_API_KEY"

Find the integration with "platform": "linkedin" and note the id.

3. Publish a Post

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Excited to share our latest update!",
    "platforms": [
      { "platform": "linkedin", "accountId": "li_123" }
    ],
    "publishNow": true
  }'

Response:

{
  "success": true,
  "status": "published",
  "postId": "post_abc123",
  "platforms": [
    {
      "platform": "linkedin",
      "success": true,
      "platformPostUrl": "https://www.linkedin.com/feed/update/urn:li:share:123456"
    }
  ]
}

Features

Text Posts

Post text updates up to 3,000 characters.

Images & Videos

Attach media using the mediaItems array:

curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Here'\''s a look at what we'\''ve been building.",
    "platforms": [
      { "platform": "linkedin", "accountId": "li_123" }
    ],
    "mediaItems": [
      { "type": "image", "url": "https://cdn.example.com/photo.jpg" }
    ],
    "publishNow": true
  }'

Supported media:

  • Images: JPG, PNG, GIF (up to 9 per post)
  • Videos: MP4 (1 per post, up to 5 GB)

Visibility

Control post visibility using platformSpecificData.visibility:

  • "PUBLIC" (default) — visible to everyone
  • "CONNECTIONS" — visible to connections only
curl -X POST "https://api.postpeer.dev/v1/posts" \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "An update for my network.",
    "platforms": [
      {
        "platform": "linkedin",
        "accountId": "li_123",
        "platformSpecificData": {
          "visibility": "CONNECTIONS"
        }
      }
    ],
    "publishNow": true
  }'

Limits

LimitValue
Character limit3,000 per post
Images per post9
Videos per post1
Max video size5 GB
Max image size10 MB

On this page