Zernio
APIFor you
Zernio
APIFor you
Platforms

LinkedIn

Overview

Publish

PostsPlatform Fields & TargetingMedia Requirements

Engage

AnalyticsInbox

Reference

Limits & Errors
Dashboard
OverviewPlatformsAPI ReferenceResources
LinkedIn

Posts

Publish text, image, video, document, poll and repost posts to LinkedIn, post to several organizations, restrict by country and edit a published post.


A plain post becomes a text post. Media in mediaItems selects an image, video or document post.

Fields in platformSpecificData on the LinkedIn entry add polls, reposts, a first comment and organization targeting.

Text post

Up to 3,000 characters. LinkedIn collapses the rest behind a "see more" fold, so put the hook first.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data: published } = await zernio.posts.createPost({
  body: {
    content: 'I spent 3 years building the wrong product.\n\nHere is what I learned about validating ideas before writing code.',
    platforms: [
      { platform: 'linkedin', accountId: '66b2e19d8c3f5a7e9d0b1c2d' }
    ],
    publishNow: true
  }
});

console.log(published.post.platforms[0].platformPostUrl);

Response (201):

{
  "post": {
    "_id": "65f1c0a9e2b5af0012ab34cd",
    "status": "published",
    "platforms": [
      {
        "platform": "linkedin",
        "status": "published",
        "platformPostUrl": "https://www.linkedin.com/feed/update/urn:li:share:..."
      }
    ]
  }
}

Every sample below changes only the mediaItems or the platforms entry of this request.

Image post

One image, recommended 1200 x 627 px (landscape), or up to 20 images in one post. Images cannot share a post with a video or a document:

"mediaItems": [
  { "type": "image", "url": "https://cdn.example.com/photo1.jpg" },
  { "type": "image", "url": "https://cdn.example.com/photo2.jpg" },
  { "type": "image", "url": "https://cdn.example.com/photo3.jpg" }
]

Video post

One video per post. Personal profiles accept up to 10 minutes, organization pages up to 30 minutes, in MP4, MOV or AVI:

"mediaItems": [
  { "type": "video", "url": "https://cdn.example.com/demo.mp4" }
]

Document post

A PDF, PPT, PPTX, DOC or DOCX displays as a swipeable carousel. At most 100 MB and 300 pages, one per post, with no images or videos alongside it.

LinkedIn requires a title. Set documentTitle, or Zernio falls back to the media item title, then the filename:

"mediaItems": [
  { "type": "document", "url": "https://cdn.example.com/report.pdf" }
],
"platforms": [
  {
    "platform": "linkedin",
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platformSpecificData": { "documentTitle": "2027 Industry Report" }
  }
]

The first page is the cover. Password-protected PDFs do not work.

Poll

poll creates a LinkedIn poll:

  • A question of 1 to 140 characters.
  • 2 to 4 options of 1 to 30 characters each.
  • A duration of ONE_DAY, THREE_DAYS, SEVEN_DAYS (default) or FOURTEEN_DAYS.

A poll cannot be combined with mediaItems or reshareUrl, and cannot be edited after publishing.

API-created polls are non-sponsored only (they cannot be promoted as ads):

{
  "platform": "linkedin",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "poll": {
      "question": "Which feature should we build next?",
      "options": ["API keys", "Webhooks", "SDKs"],
      "duration": "SEVEN_DAYS"
    }
  }
}

Repost

reshareUrl reposts an existing LinkedIn post. It takes the post's link (its "Copy link to post" action) or a urn:li:share, urn:li:ugcPost or urn:li:groupPost URN.

The published post is always a reshare authored by your account, with the original embedded underneath:

  • With content or customContent, your text is the commentary ("repost with your thoughts").
  • With no text, it publishes as a text-free reshare.

LinkedIn's API cannot create the one-click "Repost" feed treatment where the original author stays the author.

reshareUrl is mutually exclusive with mediaItems, and works on personal profiles and organization pages:

{
  "platform": "linkedin",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "reshareUrl": "https://www.linkedin.com/posts/someone_some-post-id"
  }
}

First comment

firstComment posts a comment right after publishing. Put external links there, because LinkedIn suppresses posts with a URL in the caption:

{
  "platform": "linkedin",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "firstComment": "Read the full guide here: https://example.com/api-guide"
  }
}

Link preview

A text post with a URL and no media gets an automatic preview card. disableLinkPreview: true suppresses it:

{
  "platform": "linkedin",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": { "disableLinkPreview": true }
}

Post to several organizations

One connected account can post to every organization page the member administers. List them with LinkedIn organizations:

curl "https://zernio.com/api/v1/accounts/66b2e19d8c3f5a7e9d0b1c2d/linkedin-organizations" \
  -H "Authorization: Bearer $ZERNIO_API_KEY"

Response (200):

{
  "organizations": [
    { "id": "111111111", "name": "Example Corp", "vanityName": "example-corp", "localizedName": "Example Corp" },
    { "id": "222222222", "name": "Example Labs", "vanityName": "example-labs", "localizedName": "Example Labs" }
  ]
}

Then repeat the platforms entry with the same accountId and a different organizationUrn (urn:li:organization: followed by the organization id).

Omit it to post to the account's default organization or personal profile:

"platforms": [
  {
    "platform": "linkedin",
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platformSpecificData": { "organizationUrn": "urn:li:organization:111111111" }
  },
  {
    "platform": "linkedin",
    "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
    "platformSpecificData": { "organizationUrn": "urn:li:organization:222222222" }
  }
]

Geo-restriction

geoRestriction.countries limits who sees the post: only followers in the listed countries.

Organization pages only. LinkedIn rejects the post unless the targeted audience exceeds 300 followers:

{
  "platform": "linkedin",
  "accountId": "66b2e19d8c3f5a7e9d0b1c2d",
  "platformSpecificData": {
    "geoRestriction": { "countries": ["US", "ES"] }
  }
}

countries takes up to 25 uppercase ISO 3166-1 alpha-2 codes.

Zernio resolves them to LinkedIn geo URNs. 45 countries are mapped, and unsupported codes are skipped silently.

Edit a published post

Edit post replaces the text of a LinkedIn post that is already published, on member profiles and organization pages alike.

  • Edits are text-only and capped at the same 3,000 characters as publishing.
  • There is no time window and no limit on the number of edits.
  • The post keeps its id, and LinkedIn shows an "edited" marker on it.
  • Mentions and hashtags in the new text are preserved.
  • Media, polls, articles and reshare targets cannot be changed.
const { data: edited } = await zernio.posts.editPost({
  path: { postId: '65f1c0a9e2b5af0012ab34cd' },
  body: {
    platform: 'linkedin',
    content: 'Updated post text with corrected information',
    accountId: '66b2e19d8c3f5a7e9d0b1c2d'
  }
});

console.log(edited.url);

Response (200):

{
  "success": true,
  "id": "urn:li:share:7200000000000000000",
  "url": "https://www.linkedin.com/feed/update/urn:li:share:7200000000000000000"
}

accountId picks which copy to edit when the post went to several LinkedIn accounts. Without it, the first linkedin entry on the post is edited.

Was this page helpful?

LinkedIn

Publish text, image, video, document and poll posts to LinkedIn personal profiles and organization pages with the Zernio API, with reposts, geo-restriction, multi-organization posting and text edits.

Platform Fields & Targeting

Every platformSpecificData field for LinkedIn, and audience targeting on organization pages.

On this page

Text postImage postVideo postDocument postPollRepostFirst commentLink previewPost to several organizationsGeo-restrictionEdit a published post