Sharing Web Content to LinkedIn via the Share API: A Practical Guide
Learn how to enable one‑click sharing of web content to LinkedIn using the Share API, including authentication, request format, a curl example, and the limits you must watch for.
09 Sept 2025, 00:22 UTC

If you run a blog or product site and want visitors to push a link to their LinkedIn feed with a single click, you need a way to post on their behalf without asking them to copy‑paste URLs. LinkedIn’s Share API (the ugcPosts endpoint) does exactly that, provided you have an OAuth token with the right scope. This guide walks through the authentication steps, shows how to build a valid request, gives a concrete curl example, and outlines the limits you should watch for.
1. Prerequisites: OAuth token and required scopes
Before you can call the API you must obtain an access token for the LinkedIn member who will be the author of the post. The token needs the w_member_social scope, which permits sharing to the member’s personal feed. If you also need to post to a Company Page, the member must be an admin of that page and you must request the w_organization_social scope instead (or in addition).
Typical flow:
- Register an application in the LinkedIn Developer Portal and note the Client ID and Client Secret.
- Redirect the user to LinkedIn’s OAuth dialog, requesting
w_member_social(and optionallyw_organization_social). - Exchange the authorization code for an access token via
POST https://www.linkedin.com/oauth/v2/accessToken. - Store the token securely; it will be used in the
Authorization: Bearerheader for every Share API call.
2. Crafting the JSON payload
The Share API expects a POST to https://api.linkedin.com/v2/ugcPosts with a JSON body that describes the content. For a simple article share you need:
author: the URN of the member (e.g.,urn:li:person:{id}). You can get the member ID from the token’ssubclaim or by calling themeendpoint.lifecycleState: set toPUBLISHED.specificContent: acom.linkedin.ugc.ShareContentobject containing:shareCommentary: optional plain‑text comment from the user.shareMedia: an array with one entry whosestatusisREADYandmediapoints to the URL you want to share (typeARTICLE).
visibility: typicallycom.linkedin.ugc.MemberNetworkVisibility(visible to connections).
When a URL is supplied, LinkedIn’s crawler fetches Open Graph tags (og:title, og:description, og:image) to build the card that appears in the feed.
3. Worked example: sharing an article with curl
Below is a ready‑to‑run curl command. Replace the placeholders with your actual values. Run it in a terminal where you have network access and the curl utility installed.
curl -X POST 'https://api.linkedin.com/v2/ugcPosts' \
-H 'Authorization: Bearer ' \
-H 'Content-Type: application/json' \
-d '{
"author": "urn:li:person:",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Check out this interesting article!"
},
"shareMedia": [
{
"status": "READY",
"media": {
"uri": "https://example.com/blog/post-123",
"mediaCategory": "ARTICLE"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": {}
}
}'
Where to run it: Any shell (bash, zsh, PowerShell) with curl.
Required permissions: The ACCESS_TOKEN must have been obtained with the w_member_social scope.
Placeholders:
<ACCESS_TOKEN>– the OAuth 2.0 bearer token.<MEMBER_ID>– the numeric LinkedIn ID of the member (found in the token or viahttps://api.linkedin.com/v2/me).<URL>– replace the example URL with the target article.
Expected checks:
- HTTP status
201 Createdindicates the post was accepted. - The response body contains a
idfield likeurn:li:ugcPost:1234567890. Store this URN if you need to later retrieve engagement metrics. - If you receive
401 Unauthorized, verify the token is still valid and includes the correct scope. - A
429 Too Many Requestsmeans you have hit the per‑token rate limit (default 100 calls per 24 h).
Risks: Using an expired or incorrectly scoped token will fail silently unless you inspect the response. Also, if the target page blocks LinkedIn’s user‑agent or lacks Open Graph tags, the generated card may fall back to a generic preview, reducing click‑through.
4. Limitations and practical verification
Even with a working request, be aware of these constraints:
- Member‑only sharing: The API cannot post to a Company Page unless the acting member is an admin and you have the
w_organization_socialscope. - URL preview reliance: LinkedIn’s crawler must be able to fetch the page. Test by sharing the URL manually on LinkedIn first; if the preview looks off, add or fix
og:title,og:description, andog:imagetags. - Rate limits: The default limit is modest for high‑traffic sites. If you expect more than 100 shares per token per day, apply for higher limits through the LinkedIn Marketing Developer Program or implement a token‑rotation strategy using multiple authorized members.
To verify that your integration works as intended:
- After receiving the
201response, note the returnedugcPostURN. - Call
GET https://api.linkedin.com/v2/ugcPosts/{urn}with the same bearer token; the response should include the share commentary and the URL you supplied. - Optionally, check the member’s LinkedIn feed (via the web UI) to confirm the post appears with the expected card.
Actionable closing
Start by registering a LinkedIn developer app, generate a test token with w_member_social, and run the curl example above against a URL you control. Verify the response, check the preview, and then embed the same request logic into your site’s “Share on LinkedIn” button. Monitor the HTTP responses for 429 errors and consider caching tokens or rotating authors if you approach the daily limit. With these steps you’ll give visitors a reliable one‑click path to LinkedIn while staying within the platform’s rules.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.