LinkedIn has become a powerful content platform, with B2B marketers telling us that half of the traffic they receive from social networks comes from LinkedIn. Make sure your content reaches an audience of professionals who are looking for relevant articles and information.

Use Share on LinkedIn to:

  • Grow your user base and drive traffic to your website
  • Get your content in front of a potential audience of millions of professionals
  • Benefit from viral distribution as people share your content with their professional networks

 

How would you like to Share on LinkedIn?

  • Before you get started …

    Please make sure to read the Getting Started with the REST API guide.  It contains important information to successfully share content with LinkedIn from within your application.

    There are two methods for sharing content via the REST API.  The API endpoint is the same, regardless of the method you choose — only the format of the request body differs.

    1. Post a comment that includes a URL to the content you wish to share — LinkedIn analyzes the included URL and automatically identifies the title, description, image, etc.
    2. Share with specific values — You provide the title, description, image, etc., directly via the parameters of the API call.
    POST
    https://api.linkedin.com/v1/people/~/shares?format=json

    Request body

      Field DescriptionMax Length (chars)
    content A collection of fields describing the shared content. 
     titleThe title of the content being shared.
    200
     descriptionThe description of the content being shared.256
     submitted-urlA fully qualified URL for the content being shared.
    n/a
     submitted-image-urlA fully qualified URL to a thumbnail image to accompany the shared content.

    The image should be at least 80 x 150px for best results.
    n/a
    comment
     

    A comment by the member to associated with the share.
     

    If none of the above content parameters are provided, the comment must contain a URL to the content you want to share.  If the comment contains multiple URLs, only the first one will be analyzed for content to share.

    700
    visibility A collection of visibility information about the share.
     
     code

    One of the following values:

    • anyone:  Share will be visible to all members.
    • connections-only:  Share will only be visible to connections of the member performing the share.
       

    This field is required in all sharing calls.

    n/a

    Share via a comment containing a URL

    To share content on LinkedIn by referencing a URL in a comment, only the comment and visibility parameters are required in the body of the request:

    JSON
    {
      "comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
      "visibility": {
        "code": "anyone"
      }
    }

    If you opt to provide a JSON-formatted body, make sure your HTTP request includes the following headers:

    Required HTTP headers for JSON body
    Content-Type: application/json
    x-li-format: json

    Alternatively, you can supply the body in the following XML format with no additional HTTP headers required: 

    XML POST body
    <share>
      <comment>Check out developer.linkedin.com! http://linkd.in/1FC2PyG</comment>
      <visibility>
        <code>anyone</code>
      </visibility>
    </share>

    Share with specific values

    If your application has all of the information about the content that you want to share, the best way to share it is by providing those values directly in the API call:

    JSON POST body
    {
      "comment": "Check out developer.linkedin.com!",
      "content": {
        "title": "LinkedIn Developers Resources",
        "description": "Leverage LinkedIn's APIs to maximize engagement",
        "submitted-url": "https://developer.linkedin.com",  
        "submitted-image-url": "https://example.com/logo.png"
      },
      "visibility": {
        "code": "anyone"
      }  
    }

    To share content with a JSON-formatted body, make sure your HTTP request includes the following headers:

    Required HTTP headers for JSON body
    Content-Type: application/json
    x-li-format: json

    Alternatively, you can supply the body in the following XML format with no additional HTTP headers required: 

    XML POST body
    <share>
      <comment>Check out developer.linkedin.com!</comment>
      <content>
        <title>LinkedIn Developer Resources</title>
        <description>Leverage LinkedIn's APIs to maximize engagement</description>
        <submitted-url>https://developer.linkedin.com</submitted-url>
        <submitted-image-url>https://example.com/logo.png</submitted-image-url>
      </content>
      <visibility>
        <code>anyone</code>
      </visibility>
    </share>

    Successful Response

    If your share request was successful, you will receive an HTTP 201 response code and the following request body:

    Sample response
    {
      "updateKey": "UPDATE-3346389-595113200…",
      "updateUrl": "https://www.linkedin.com/updates?discuss=…&scope=…"
    }

    The updateKey is a unique ID for the shared content posting that was just created.  The updateURL value is a direct link to the newly shared content on LinkedIn.com that you can direct the user's web browser to.

    Duplicate shares

    In order to prevent spam in the LinkedIn feed, you cannot repeatedly post the same shared content.  If you do, the API call will return with an HTTP 400 error:

     

    {
      errorCode: 0, 
      message: "Do not post duplicate content", 
      requestId: "ABC123DEF", 
      status: 400, 
      timestamp: 1420102800000 
    }
  • Before you get started …

    The JavaScript SDK allows you to share content on a member's LinkedIn feed using JavaScript-based API calls.  If you are looking for a quick JavaScript-powered social sharing plugin for your website, please visit the Plugin section.

    Please make sure to read the Getting Started with the JavaScript SDK guide.  It contains important information to successfully share content with LinkedIn from within your application.

    Step 1 - Initialize the SDK

    In order to use any of the functionality provided by the JavaScript SDK, it must be included in your webpage's <head> section.  Follow the directions in the getting started guide to initialize the SDK.

    Step 2 - Authenticate the user

    Place the following special block in your HTML wherever you want the "Sign in with LinkedIn" button to be rendered:

    javascript
    <script type="in/Login"></script>

    This will generate a button that looks like the image below.&nbsp; Note that the text on the button is presented in English by default, but can be localized to other languages using the lang argument when initializing the SDK.

    Step 3 - Handle async authentication & share content

    When a user clicks the sign in button, a pop-up window containing the LinkedIn authentication dialog will be presented.  Once the user has accepted the request and provided their LinkedIn account credentials, the window will be dismissed and the SDK will perform the back-end call to LinkedIn to silently complete the authentication process for you.  Since this request happens asynchronously, you must define a function that will listen for an auth event to be thrown so that you know that the authentication process has completed and that it is safe for your application to make further API calls.

    Use the onLoad argument in the SDK's <script> block when you initialize the SDK to choose a function to execute once the SDK has finished loading.  This function should then setup the auth event listener, as shown below.  Once an auth event is thrown, it's safe to use the SDK's generic API call wrapper, IN.API.Raw(), to make a REST API call to share content with LinkedIn on the member's behalf.

    You can find additional details about what the POST payloads for sharing content look like on in the REST API documentation section of Share with LinkedIn.

    javascript
    <script type="text/javascript" src="//platform.linkedin.com/in.js">
      api_key: YOUR_API_KEY_HERE
      authorize: true
      onLoad: onLinkedInLoad
    </script>
    
    <script type="text/javascript">
        
      // Setup an event listener to make an API call once auth is complete
        function onLinkedInLoad() {
          IN.Event.on(IN, "auth", shareContent);
        }
    
      // Handle the successful return from the API call
      function onSuccess(data) {
        console.log(data);
      }
    
      // Handle an error response from the API call
      function onError(error) {
        console.log(error);
      }
    
      // Use the API call wrapper to share content on LinkedIn
      function shareContent() {
            
        // Build the JSON payload containing the content to be shared
        var payload = { 
          "comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG", 
          "visibility": { 
            "code": "anyone"
          } 
        };
    
        IN.API.Raw("/people/~/shares?format=json")
          .method("POST")
          .body(JSON.stringify(payload))
          .result(onSuccess)
          .error(onError);
      }
    
    </script>
  • Before you get started …

    Please make sure to read the Getting Started with the Mobile SDK for Android guide. It contains important information to successfully incorporate applying in with LinkedIn within your application.

    Step 1 - Authenticate the user

    Authenticating a user in a mobile Android environment is described in detail in the Authenticating using the Mobile SDK for Android guide. Once you have successfully authenticated your mobile user, you can continue to the next step of the workflow.

    Step 2 - Share content via API POST request

    Once your mobile users have authenticated or you have otherwise established a LISession on their behalf, you can use the ApiHelper.postRequest() method to POST share data from your mobile application.

    You can find additional details about what the POST payloads for sharing content look like on in the REST API documentation section of Share with LinkedIn.

    java
    String url = "https://api.linkedin.com/v1/people/~/shares";
    
    String payload = "{" +
        "\"comment\":\"Check out developer.linkedin.com! " +
        "http://linkd.in/1FC2PyG\"," +
        "\"visibility\":{" +
        "    \"code\":\"anyone\"}" +
        "}";
                    
    APIHelper apiHelper = APIHelper.getInstance(getApplicationContext());
    APIHelper.postRequest(this, url, payload, new ApiListener() {
        @Override
        public void onApiSuccess(ApiResponse apiResponse) {
            // Success!
        }
    
        @Override
        public void onApiError(LIApiError liApiError) {
            // Error making POST request!
        }
    });
  • By presenting your users with a simple parameterized link, they will be able to share relevant articles to their LinkedIn network without requiring you to do any customized programming. 

    When clicked, the user will be taken to a sharing page on linkedin.com, pre-populated with the values you provide in the link — where they will still have to confirm the sharing action.  If the user is not logged into LinkedIn at the time, they will have to login before the article can be shared. 

    This link can be opened in the current window, a new window or a pop-up that is sized to 520 x 570px — whichever best suits website's layout.

    GET
    https://www.linkedin.com/shareArticle

    Request parameters

    ParameterDescriptionMax  LengthRequired
    urlThe url-encoded URL of the page that you wish to share.
    1024Yes
    miniA required argument who's value must always be:  true4Yes
    titleThe url-encoded title value that you wish you use.
    200No
    summaryThe url-encoded description that you wish you use.256No
    source

    The url-encoded source of the content (e.g. your website or application name)

    200No

    Here is a complete example of what a complete LinkedIn content sharing URL might look like:

    Example sharing url
    https://www.linkedin.com/shareArticle?mini=true&url=http://developer.linkedin.com&title=LinkedIn%20Developer%20Network&summary=My%20favorite%20developer%20program&source=LinkedIn
  • Easy social sharing on LinkedIn

    Using our sharing plugin is simple way to add a LinkedIn social sharing widget to your webpage.

    • Share plugin example

    Use the Share Plugin Generator to generate customized Javascript code that you can drop into your HTML so that you can be sharing your content on LinkedIn within minutes.

     

  • Before you get started …

    Please make sure to read the Getting Started with the Mobile SDK for iOS guide. It contains important information to successfully incorporate applying in with LinkedIn within your application.

    Step 1 - Authenticate the user

    Authenticating a user in a mobile iOS environment is described in detail in the Authenticating using the Mobile SDK for iOS guide. Once you have successfully authenticated your mobile user, you can continue to the next step of the workflow.

    Step 2 - Share content via API POST request

    Once your mobile users have authenticated or you have otherwise established a LISession on their behalf, you can use the ApiHelper.postRequest() method to POST share data from your mobile application.

    You can find additional details about what the POST payloads for sharing content look like on in the REST API documentation section of Share with LinkedIn.

    Objective-C
    NSString *url = [NSString initWithString:@"https://api.linkedin.com/v1/people/~/shares"];
    
    NSString *payload = [NSString initWithString:@"{
        \"comment\":\"Check out developer.linkedin.com! http://linkd.in/1FC2PyG\",
        \"visibility\":{ \"code\":\"anyone\" }
    }"];
    
    if ([LISDKSessionManager hasValidSession]) {
        [[LISDKAPIHelper sharedInstance] postRequest:url stringBody:payload
        success:^(LISDKAPIResponse *response) {
            // do something with response
        }
        error:^(LISDKAPIError *apiError) {
            // do something with error
        }];
    ]}

Permissions and Limits

Required permission: w_share

Whether set as a default permission in your app settings or requested specifically via the scope argument during your authentication process, you will need to request the w_share member permission in order for your application to successfully make the API call to share content.

Throttle Limits

Throttle Type
Daily Call Limit (UTC)
Application maximum                                                                        
125,000
Per individual user25
Per individual developer100

Improve content sharing with Open Graph

If you are a content author and want to improve the results when you or anyone else shares your content on LinkedIn, you can control what LinkedIn (and most other major content sharing platforms) will present in the share by including the Open Graph standard's <meta> tags in the <head> of your HTML page.

If Open Graph tags are present, LinkedIn's crawler will not have to rely on it's own analysis to determine what content will be shared, which improves the likelihood that the information that is shared is exactly what you intended.

Sample Open Graph meta tags
<html prefix="og: http://ogp.me/ns#">
<head>
  <meta property="og:title" content="My Shared Article Title" />
  <meta property="og:description" content="Description of shared article" />
  <meta property="og:url" content="http://example.com/my_article.html" />
  <meta property="og:image" content="http://example.com/foo.jpg" />
</head>
<body>
   …
</body>
</html>

For the highest quality presentation on LinkedIn.com, the image referenced in og:image should be at least 80 x 150px to prevent it from being artificially stretched to fit the layout.

If you are sharing content directly via API calls, you will have the opportunity to control exactly what information is shared using the parameters of the API call.

Shared Content Caching

The first time that LinkedIn's crawlers visit a webpage when asked to share content via a URL, the data it finds (Open Graph values or our own analysis) will be cached for a period of approximately 7 days.

This means that if you subsequently change the article's description, upload a new image, fix a typo in the title, etc., you will not see the change represented during any subsequent attempts to share the page until the cache has expired and the crawler is forced to revisit the page to retrieve fresh content.

If you make API calls that directly provide the content to be shared rather than by a URL that requires analysis, LinkedIn will always use the values you provide.

Some of the companies using Share with LinkedIn