LinkedIn API
Options for posting using the LinkedIn API
The LinkedIn API has the following requirements and restrictions:
- The
postfield 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 cannot be retrieved, the post will still be published and a
linkPreviewFailed: truefield will be returned in the /post response.- Hashtags are clickable in LinkedIn. Use the # symbol to specify a LinkedIn hashtag.
If publishing a video and doesn't end in a known video extension such as mp4, please use the
isVideoparameter. 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.
LinkedIn also supports sending media without post text. If you do not want post text included send an empty String
post: "".- You may link either a company page or a personal LinkedIn account.
See LinkedIn Media Guidelines and LinkedIn Authorization for more information.
You must be a "Super Admin" or a "Content Admin" to connect a LinkedIn company page.
Posting to LinkedIn
JSON for a basic post with a link and image to LinkedIn:
{
"post": "The best LinkedIn post ever #best https://www.linkedin.com", // empty string is allowed
"mediaUrls": ["https://img.acme.com/012/gb.jpg"],
"platforms": ["linkedin"]
}LinkedIn Options
You can set additional options for a post by using the linkedInOptions parameter.
{
"linkedInOptions": {
"altText": ["This is my best pic", "😃 here is the next one"],
"disableShare": true,
"targeting": {
"countries": ["US", "IN", "DE", "GB"],
"seniorities": ["Senior", "VP"],
"degrees": ["Master of Digital Design", "Bachelor of Engineering"],
"fieldsOfStudy": ["Consumer Economics", "Computer Games and Programming Skills"],
"industries": ["Telecommunications Carriers", "Banking"],
"jobFunctions": ["Information Technology", "Entrepreneurship"],
"staffCountRanges": ["size_51_to_200", "size_5001_to_10000"]
},
"thumbNail": "https://example.com/thumbnail.jpg",
"title": "Sample PPTX",
"titles": ["This is an amazing video", "😃 here is the next one"],
"visibility": "public"
}
}LinkedIn options are optional fields that can be used to control the post.
altTextarray of stringsThe alternative text of images for accessibility and screen readers.
See LinkedIn Alternative Text for more information.
disableSharebooleandefault: falseDisable the ability for users to reshare the LinkedIn post.
See LinkedIn Disable Share for more information.
targetingobjectTarget your organic posts to specific groups by countries, industry, job title, and more.
Requires at least 300 followers in the targeted audience.
See LinkedIn Audience Targeting for more information.
thumbNailstringThe thumbnail of a video. Must be PNG or JPG, same dimensions as video, under 10MB. URL should end in .png or .jpg.
See LinkedIn Video Thumbnail for more information.
titlestringThe title of a document when posting PPT, PPTX, DOC, DOCX, or PDF files. Maximum length: 400 characters.
If not specified, the filename is used.
See LinkedIn Documents for more information.
titlesarray of stringsTitle or media captions to LinkedIn images or videos.
Each title corresponds to a media URL in order.
See LinkedIn Media Titles for more information.
visibilitystringdefault: publicThe visibility of the post.
Values: public, connections, or loggedin.
See LinkedIn Post Visibility for more information.
Alternative Text
Add LinkedIn alternative text, also known as LinkedIn 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 or documents.
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.
Audience Targeting
LinkedIn allows you to target your organic posts to specific groups of users. You can target by countries, industry, job title, and more.
LinkedIn targeting requires at least 300 followers in the targeted audience. For example if you have 400 followers and target just users in the country US, but only 200 of your followers are in the US, the targeting will fail since the audience is too small.
Use the targeting object in the linkedInOptions object:
{
"linkedInOptions": {
"targeting": {
"countries": ["US", "IN", "DE", "GB"],
"seniorities": ["Senior", "VP"],
"degrees": ["Master of Digital Design", "Bachelor of Engineering"],
"fieldsOfStudy": ["Consumer Economics", "Computer Games and Programming Skills"],
"industries": ["Telecommunications Carriers", "Banking"],
"jobFunctions": ["Information Technology", "Entrepreneurship"],
"staffCountRanges": ["size_51_to_200", "size_5001_to_10000"]
}
}
}The available targeting options are listed in the following JSON files:
- LinkedIn Countries
- LinkedIn Seniorities
- LinkedIn Degrees
- LinkedIn Fields of Study
- LinkedIn Industries
- LinkedIn Job Functions
Authorization Refresh
LinkedIn must be reauthorized every year via the Social Accounts page.
An email and webhook social action notification will be sent 15 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.
Character Limits
Please see LinkedIn Character Limits for more information.
Disable Share
You can disable the ability for users to reshare the LinkedIn post by setting the disableShare field to true in the linkedInOptions object:
{
"linkedInOptions": {
"disableShare": true
}
}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 used.
},
"mediaUrls": ["https://scholar.harvard.edu/files/torman_personal/files/samplepptx.pptx"]
}The media URL provided must end in a known document extension: ppt, pptx, doc, docx, or pdf.
LinkedIn Mentions
You may mention other LinkedIn organizations, i.e. company pages, or member profiles, i.e. individual profile pages, in your posts.
ACME makes an attempt to resolve the @mention by doing a lookup on the handle. 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 cannot be mentioned.
If any mention in a LinkedIn post cannot be resolved (due to privacy settings, account restrictions, or other platform limitations), LinkedIn may fail to render all mentions in that post as clickable links. This is LinkedIn's platform behavior and not an API issue. To avoid this, ensure all mentioned users and organizations allow mentions from your organization or consider posting mentions separately to isolate any problematic mentions.
Please review the important rules on mentions.
Organization Profiles
Mention another LinkedIn organization handle by adding @handle in the post text. The @handle is the name of the company or organization.
You can mention in posts, comments, and reply to comments.
For example,
ACME's LinkedIn company profile is https://www.linkedin.com/company/acme and the handle used would be @acme.
Zara's LinkedIn company profile is https://www.linkedin.com/company/zara-sa/ and the handle used would be @zara-sa.
{
"post": "The best social media API @acme ever!",
"platforms": ["linkedin"]
}Member Profiles
Mention another LinkedIn member profile by adding @vanity_name or @[John Smith] in the post text.
@vanity_nameis the vanity name of the member profile. For example in the member's profile URLhttps://www.linkedin.com/in/vanity_name/, the vanity name isvanity_name.@[John Smith]is the person's full name. For example if the person's full name isJohn Smith, the mention would be@[John Smith].
You can mention in posts, comments, and reply to comments.
{
"post": "The best social media API @[John Smith] and @ava_smith ever!",
"platforms": ["linkedin"]
}In the above example, John Smith and Ava Smith will be mentioned in the post - the first using their full name and the second using their vanity name.
Important Notes:
- You must have a LinkedIn company page connected to your ACME account to mention member profiles. If you connect your own personal LinkedIn account, you will not be able to mention other people's profiles.
- LinkedIn only allows mentioning people who follow your organization / company page.
Media 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.
Post Visibility
LinkedIn allows you to control the visibility of your posts. You can set the visibility to public, connections only, or loggedin users only. If no visibility is specified, the post will be "public" and visible to all LinkedIn users.
public: The post will be visible to all LinkedIn users. Available for both company pages and personal LinkedIn connected accounts. Default if no visibility is specified.connections: The post will be visible to the 1st degree network of the owner (user profile). Available for personal LinkedIn connected accounts only.loggedin: The post will be visible to logged in LinkedIn users only. Available for both company pages and personal LinkedIn connected accounts.
Use the visibility field in the linkedInOptions object:
{
"linkedInOptions": {
"visibility": "public" // "public", "connections", or "loggedin"
}
}Video Publishing Permissions
On LinkedIn, only users with specific permissions can publish videos to company pages:
- Users with Admin permissions.
- Users with Direct Sponsored Content (DSC) permissions.
Content Administrators do not have the ability to publish videos to LinkedIn company pages.
Video Thumbnail
Set a LinkedIn 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"
}
}Please see here for more examples of using the LinkedIn API.