This guide is for mainly for developers and people who want to stay up to date on LinkedIn API development.
Are your LinkedIn posts missing previews when posted through the API? You're not alone. This common issue has a simple solution, and we'll show you exactly how to fix it.
The LinkedIn API Preview Problem
Many developers face a frustrating issue when using LinkedIn's API to post content - the link previews (image, title, and description) simply don't appear, leaving posts looking incomplete and unprofessional. After extensive research and direct communication with LinkedIn support, we've identified the exact cause and solution for this problem.
What's Happening Behind the Scenes
On May 31, 2021, LinkedIn made a significant change to how their API handles article-type posts. According to their official documentation:
"For article type posts the description, title, and thumbnail will be set from LinkedIn's URL Preview of the URL only if the description, title, and thumbnail are not provided from the API call. Prior to this change, each field was set from LinkedIn's URL Preview if the specific field was not set."
- LinkedIn API Documentation
In simpler terms, LinkedIn now uses an "all-or-nothing" approach to link previews:
- If you provide ANY metadata fields (title, description, or thumbnail) in your API call, LinkedIn will use ONLY what you provided and will NOT scrape the URL for additional info.
- If you provide NO metadata fields and only include the URL, LinkedIn will automatically scrape the webpage and generate a complete preview with title, description, and thumbnail.
This change has broken many implementations that were previously working, where developers would provide some fields but rely on LinkedIn to fill in others automatically.
The Solution: Let LinkedIn Do the Work
After direct confirmation from LinkedIn support, the solution is straightforward:
Option 1: Provide NO Metadata (Recommended)
Remove ALL metadata fields (title, description, and thumbnail) from your API request and provide only the URL. This allows LinkedIn's scraper to generate a complete preview automatically.
Before (Not Working):
{
"author": "urn:li:person:USER_ID",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Check out this great article!"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "Article description here"
},
"originalUrl": "https://example.com/article",
"title": {
"text": "Article Title"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
After (Working):
{
"author": "urn:li:person:USER_ID",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Check out this great article!"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"originalUrl": "https://example.com/article"
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"
}
}
Option 2: Provide ALL Metadata
If you need precise control over how your posts appear, you must provide ALL metadata fields (title, description, and thumbnail URL). This prevents LinkedIn from scraping any data from the URL.
Note: This approach requires you to handle scraping the target webpage yourself to extract relevant metadata.
Real-World Implementation in C#
Here's a simplified example of how we fixed this issue in a C# application that automates LinkedIn posting:
// MODIFIED: Let LinkedIn scrape the preview by only providing the URL
// and not the description/title/etc - following the "all-or-nothing" approach
postData = new JObject
{
["author"] = authorUrn,
["lifecycleState"] = "PUBLISHED",
["specificContent"] = new JObject
{
["com.linkedin.ugc.ShareContent"] = new JObject
{
["shareCommentary"] = new JObject
{
["text"] = content
},
["shareMediaCategory"] = "ARTICLE",
["media"] = new JArray
{
new JObject
{
["status"] = "READY",
["originalUrl"] = item.Link
// Removed description and title fields to let LinkedIn scrape them
}
}
}
},
["visibility"] = new JObject
{
["com.linkedin.ugc.MemberNetworkVisibility"] = "PUBLIC"
}
};
Testing Your Implementation
After implementing this change, you should immediately see your posts displaying proper previews with images, titles, and descriptions pulled directly from your shared URLs.
Troubleshooting Tips:
- Make sure your webpage has proper meta tags - LinkedIn's scraper relies on standard Open Graph tags for best results
- Check your URL is accessible - LinkedIn's scraper must be able to access your page
- Verify image dimensions - LinkedIn prefers images that are at least 1200×627 pixels
- Use Post Inspector - LinkedIn's Post Inspector tool can show you exactly how your URL will preview
Conclusion
LinkedIn's 2021 API change to an "all-or-nothing" approach for link previews can be frustrating, but the solution is straightforward. By removing all metadata fields from your API request and letting LinkedIn handle the scraping, you can ensure your posts display with proper previews, making them more engaging and professional.
This simple change has solved the preview problem for numerous developers, and we hope it helps you too!
Developer Experiences
"After weeks of debugging, this simple solution immediately fixed our LinkedIn previews. Just removing the partial metadata fields made all the difference!"
- Johan K., Full Stack Developer
"Our automated LinkedIn posting system was working perfectly until May 2021. This explanation about the API change and the 'all-or-nothing' approach immediately solved our issue."
- Maria L., Marketing Automation Specialist