Social Metadata API

Warning

Deprecation Notice
The Marketing Version 202310 (Marketing October 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details. If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.

Some shares and posts may have social actions such as reactions and comments attached to them. The socialMetadata API allows you to read social actions on these shares or posts,both organic and sponsored. The new service provides access to the reactions content type, which is an expansion of likes and replaces the functionality provided by the existing socialActions endpoint.

The service currently provides the following methods:

  • Get a Summary of Social Metadata
  • Batch Get a Summary of Social Metadata
  • Enable or Disable Comments on a Thread

For creating and retrieving a comment, please visit Comments API.

Permissions

Permission Description
w_organization_social Post, comment, and react on posts on behalf of an organization. Restricted to organizations in which the authenticated member has one of the following company page roles.
  • ADMINISTRATOR
  • DIRECT_SPONSORED_CONTENT_POSTER
  • RECRUITING_POSTER
r_organization_social Retrieve organizations' posts, comments, and reactions. Restricted to organizations in which the authenticated member has one of the following company page roles.
  • ADMINISTRATOR
  • DIRECT_SPONSORED_CONTENT_POSTER
w_member_social Posts, comments and reaction posts on behalf of an authenticated member.
r_member_social Restricted Retrieve posts, reactions, and likes on behalf of an authenticated member. This permission is granted to select developers only.

Access to Social Actions APIs

Deprecation/Note: Today, all the Social Actions APIs identified are part of the permissions shown in the above table. We plan to deprecate these APIs from these permissions in June 2023.

Every Community Management developer must perform the following:

  1. Request Development tier access to the new API through developer.linkedin.com and then upgrade to the Standard Tier.
  2. Update the existing OAuth access token permissions scope to include the new permissions above. This will warrant a new consent text to be shown to your member, and a re-auth process.
APIs Old Permission Name New Permission Name Deprecation Date
/reactions /socialActions/comments /socialActions/likes /socialMetadata r_organization_social r_organization_social_feed June 2023
/reactions /socialActions/comments /socialActions/likes /socialMetadata w_organization_social w_organization_social_feed June 2023
/reactions /socialActions/comments /socialActions/likes /socialMetadata w_member_social w_member_social_feed June 2023

See Organization Access Control for more information on company page roles.

Note

You may never store profile information, other than person URNs retrieved from the shares API.

Social Metadata

Schema

Field Format Description
commentsState Enum String The state of thread comments. Possible values
  • OPEN: Thread is open to comments.
  • CLOSED: Thread is closed to comments.
  • PROCESSING: Thread is in the process of being deleted.
  • DELETED: Thread is deleted.
commentSummary Represents the comment summary of the entity being commented on.
commentSummary.count int Total number of comments (including replies).
commentSummary.topLevelCount int Total number of comments (excluding replies).
entity Urn The entity to which this Social Metadata is tied.
reactionSummaries Represents the reaction summary of the entity being reacted to. Key will be the reaction type's enum.
reactionSummaries.reactionType Enum String The type of reaction. Possible values are:
  • LIKE: "Like" in the UI
  • PRAISE: "Celebrate" in the UI
  • MAYBE: "Curious" in the UI
  • EMPATHY: "Love" in the UI
  • INTEREST: "Insightful" in the UI
  • APPRECIATION: "Support" in the UI
  • reactionSummaries.count int The total number of a given type of reactions.

    Get a Summary of Social Metadata

    GET https://api.linkedin.com/rest/socialMetadata/{shareUrn|ugcPostUrn|commentUrn}
    
    GET https://api.linkedin.com/v2/socialMetadata/{shareUrn|ugcPostUrn|commentUrn}
    

    Sample Response

    {
        "reactionSummaries": {
            "EMPATHY": {
                "reactionType": "EMPATHY",
                "count": 1
            }
        },
        "commentsState": "OPEN",
        "commentSummary": {
            "count": 4,
            "topLevelCount": 3,
         },
        "entity": "urn:li:activity:6524387688164966400"
    }
    

    Batch Get a Summary of Social Metadata

    GET https://api.linkedin.com/rest/socialMetadata?ids=List({shareUrn|ugcPostUrn|commentUrn},{shareUrn|ugcPostUrn|commentUrn})
    
    GET https://api.linkedin.com/v2/socialMetadata?ids=List({shareUrn|ugcPostUrn|commentUrn},{shareUrn|ugcPostUrn|commentUrn})
    

    Sample Response

    {
        "statuses": {},
        "results": {
            "urn:li:activity:6516117581072519168": {
                "commentsState": "OPEN",
                "entity": "urn:li:activity:6516117581072519168",
                "reactionSummaries": {
                    "PRAISE": {
                        "reactionType": "PRAISE",
                        "count": 1
                    }
                },
                "commentSummary": {
                    "count": 4,
                    "topLevelCount": 3,
                }
            },
            "urn:li:comment:(urn:li:activity:6524387688164966400,6636062862760562688)": {
                "commentsState": "OPEN",
                "entity": "urn:li:comment:(urn:li:activity:6524387688164966400,6636062862760562688)",
                "reactionSummaries": {
                    "CELEBRATION": {
                        "reactionType": "CELEBRATION",
                        "count": 5
                    }
                },
                "commentSummary": {
                    "count": 9,
                    "topLevelCount": 5,
                }
            }
        },
        "errors": {}
    }
    

    Enable or Disable Comments on a Thread

    To disable comments, set the commentsState field to CLOSED. To enable comments, set commentsState field to OPEN. This API only accepts thread Urns and will reject any writes with a comment Urn.

    Disabling comments will delete all existing comments on the thread. Reactions will be left as is. Re-enabling comments will allow comments to be written on the thread again.

    Sample Request

    POST https://api.linkedin.com/rest/socialMetadata/{shareUrn|ugcPostUrn}?actor={organizationUrn|personUrn}
    
    {
        "patch": {
            "$set": {
                "commentsState": "CLOSED"
            }
        }
    }
    
    POST https://api.linkedin.com/v2/socialMetadata/{shareUrn|ugcPostUrn}?actor={organizationUrn|personUrn}
    
    {
        "patch": {
            "$set": {
                "commentsState": "CLOSED"
            }
        }
    }
    

    A successful response returns a 202 Accepted.

    To resolve nested comments for a given parent comment, provide a parent commentUrn as the target in the request URL. A commentUrn is a composite URN constructed using a comment ID and threadUrn such as an ActivityUrn.