LinkedIn

Options for posting via the API to LinkedIn

LinkedIn API Endpoints

Overview

JSON for a basic post with a link and image to LinkedIn:

{
    "post": "The best LinkedIn post ever #best https://www.linkedin.com",
    "mediaUrls": ["https://img.ayrshare.com/012/gb.jpg"],
    "platforms": ["linkedin"]
}
  • The post field accepts up to 3,000 characters.

  • LinkedIn will automatically preview the link in the post unless there is an image or video included. In the above example the image will show. Removing the image will cause the link preview to show. If the link preview can not be retrieved, the post will still be published and a linkPreviewFailed: true field will be returned in the /post response.

  • Hashtags are clickable in LinkedIn. Use the # symbol to specify a LinkedIn hashtag.

  • If your video doesn't end in a known video extension such as mp4, please use the isVideo parameter. See the /post endpoint for details.

  • LinkedIn video processing takes several minutes to complete. Please wait before trying the share URL or getting video analytics.

  • LinkedIn limits 150 posts per day per LinkedIn account.

  • Posting to LinkedIn Groups is not supported.

You must be a "Super Admin" to connect a LinkedIn company page. If you don't see your Company Page when linking, please verify you are a Super Admin for that Page.

Video Thumbnail

Set a thumbnail for a video. Send a remote URL of a PNG or JPG file that is the same dimensions as the video and less than 10 MB. URL should end in .png or .jpg.

Use the thumbNail in the linkedInOptions object.

{
  "linkedInOptions": {
    "thumbNail": "https://octodex.github.com/images/Fintechtocat.png"
  }
}

Alternative Text

Add alternative text, also known as alt text, to a LinkedIn image. LinkedIn alt text is an accessibility feature used for additional user info and screen readers. LinkedIn does not support altText on videos.

Use the altText in the linkedInOptions object.

"linkedInOptions": {
    "altText": ["This is my best pic", "😃 here is the next one"] // Array of Alt Texts
}

Each alt text must correspond to an image in the mediaUrls array. The alt text will be applied to each image in order.

Titles

Add title or media captions to LinkedIn images or videos.

Use the titles in the linkedInOptions object.

"linkedInOptions": {
    "titles": ["This is an amazing video", "😃 here is the next one"] // Array of Alt Texts
}

Each title must correspond to an image or video in the mediaUrls array. The title will be applied to each image or video in order.

Multi Image Posts

You may post up to 9 image URLs in the mediaUrls to LinkedIn.

{
    "mediaUrls": ["https://url1", ..., "https://url9"]
}

LinkedIn does not yet support carousel images for organic posts.

LinkedIn Mentions

Mention another LinkedIn organization handle by adding @handle in the post text. The @handle is the name of the company or organization. You many mention in post, comments, and reply to comments.

For example,

{
    "post": "The best social media API @ayrshare ever!",
    "platforms": ["linkedin"]
}

If the @mention is not found, the @ will be removed from the post since LinkedIn will not accept posts with unresolved mentions. Individual LinkedIn profiles can not be mentioned.

Please review the important rules on mentions.

LinkedIn Documents

Use the API to post a document on LinkedIn. Supported file formats include: PPT, PPTX, DOC, DOCX, and PDF. Ensure the document is under 100MB in size and does not exceed 300 pages.

Below is a code sample demonstrating how to post a PPTX document with a title:

{
    "post": "What a great document",
    "platforms": [
        "linkedin"
    ],
    "linkedInOptions" : {
        "title": "Sample PPTX"    // optional. If not specified, the file name will be used.
    },
    "mediaUrls": ["https://scholar.harvard.edu/files/torman_personal/files/samplepptx.pptx"]
}

The media URL profiled must end in a known document extension: ppt, pptx, doc, docx, or pdf.

LinkedIn Auth Refresh

LinkedIn must be reauthorized every year via the Social Accounts page.

  • An email and webhook social action notification will be sent 10 days in advance of authorization expiration.

  • The refresh required date and remaining days can be retrieved from the /user endpoint.

  • The user will see on their social account linkage page an alert and a refresh button 30 days prior to expiration.

Please see here for more examples of using the LinkedIn API.

Last updated