Partager via


Posts API

Warning

Deprecation Notice
The Marketing Version 202311 (Marketing November 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.

The Posts API facilities the creation and retrieval of organic and sponsored posts.

You can include the following types of content in a Post as shown on the table below. The table also shows whether you can create organic (non-sponsored) or sponsored posts with that content type.

Content Types Organic (non-sponsored) Sponsored
Text only Yes Yes
Images Yes Yes
Videos Yes Yes
Documents Yes Yes
Article Yes Yes
Carousels No Yes
MultiImage Yes No
Poll Yes No
Celebration Yes No

Note

The Posts API replaces the ugcPosts API. See Migration Guide for more details.

Note

All APIs require the request header LinkedIn-Version: {Version in YYYYMM format}. All APIs require the request header X-Restli-Protocol-Version: 2.0.0

Permissions

Permission Description
w_organization_social Post, comment and like 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
  • CONTENT_ADMIN
  • r_organization_social Retrieve organizations' posts, comments, and likes. Restricted to organizations in which the authenticated member has one of the following company page roles:
  • ADMINISTRATOR
  • DIRECT_SPONSORED_CONTENT_POSTER
  • CONTENT_ADMIN
  • w_member_social Post, comment and like posts on behalf of an authenticated member.
    r_member_social (Restricted) Retrieve posts, comments, and likes on behalf of an authenticated member. This is a private permission.

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

    Post Schema

    Field Format Description Required
    author URN of the author of the content. Person or Organization URN create-only required
    adContext adContext type The advertising context representing the ads specific metadata (which is related to ads or viral tracking, rendering, etc.), associated with the post. The current usage is for viral posts created from an ad and dark posts. If not set, then the post does not have ad specific metadata. optional
    commentary little text The user generated commentary for the post. required
    container URN Container Entity URN that contains user generated content. If not set, the post does not belong to a container. optional
    content content type The posted content (if any, e.g., video). Optional content indicates a post with only commentary. optional
    contentLandingPage URL Web page that is opened when the member clicks on the associated content. For example, clicking on an image and then linking and taking the user to an associated web page. If empty, no landing page associated with the content. This field is ignored in Campaign Manager UI for article ads and does not map to "Destination URL" field. Required if the campaign creative has the WEBSITE_VISIT objective - otherwise optional
    contentCallToActionLabel Type of ContentCallToActionLabel which has the values of:
  • APPLY - Call To Action button on the creative shows 'Apply'.
  • DOWNLOAD - Call To Action button on the creative shows 'Download'.
  • VIEW_QUOTE - Call To Action button on the creative shows 'View Quote'.
  • LEARN_MORE - Call To Action button on the creative shows 'Learn More'.
  • SIGN_UP - Call To Action button on the creative shows 'Sign Up'.
  • SUBSCRIBE - Call To Action button on the creative shows 'Subscribe'.
  • REGISTER - Call To Action button on the creative shows 'Register'.
  • JOIN - Call To Action button on the creative shows 'Join'.
  • ATTEND - Call To Action button on the creative shows 'Attend'.
  • REQUEST_DEMO - Call To Action button on the creative shows 'Register Demo'.
  • SEE_MORE - Call To Action button on the creative shows 'See More'.
  • The call to action label which a member can act upon that is associated with the content. If empty, there is an optional call to action associated with the content. optional
    createdAt Time at which the resource was created in milliseconds since epoch. Time read-only
    distribution distribution Type Distribution of the post both in LinkedIn and externally create-only required
    id Unique ID for the object. Can contain more URN types (in development) ugcPostUrn or shareUrn read-only
    isReshareDisabledByAuthor boolean default=false Indicates whether resharing of the post has been disabled by the author. If this field is set to true, the post cannot be reshared in any context. If false, other reshare restrictions may still apply due to the post's visibility, container, or content type. optional
    lastModifiedAt Time at which the resource was last modified in milliseconds since epoch. Time read-only
    lifecycleState The state of the content. PUBLISHED is the only accepted field during creation. The following values can be returned in responses:
  • DRAFT - Represents content that is accessible only to the author and is not yet published.
  • PUBLISHED - Represents content that is accessible to all entities. This is the only accepted field during creation.
  • PUBLISH_REQUESTED - Represents content that has been submitted for publishing but is not yet ready for rendering. The content will be published asynchronously once the processing has successfully completed.
  • PUBLISH_FAILED - Represents content that has been submitted for publishing but was not processed. An edit is required in order to re-attempt publishing.
  • Enum string required
    lifecycleStateInfo optional lifecycleStateInfo Additional information about the lifecycle state for PUBLISH_REQUESTED or PUBLISH_FAILED. optional
    publishedAt The time at which the content was published represented in epoch time. long Optional
    reshareContext optional reshareContext The context in which the post was re-shared - only be set for re-shares
  • parent: URN type the direct parent of the post (i.e.,the post that was re-shared).
  • root: The greatest ancestor of the post - may also be the parent. This field is derived from the parent and supports the same URN types. root is read-only.
  • optional
    visibility Visibility restrictions on content. Type of MemberNetworkVisibility which has the values of:
  • CONNECTIONS - Represents 1st degree network of owner.
  • PUBLIC - Anyone can view this.
  • LOGGED_IN - Viewable by logged in members only.
  • CONTAINER - Visibility is delegated to the owner of the container entity. For example, posts within a group are delegated to the groups authorization API for visibility authorization.
  • MemberNetwork Visibility required

    adContext

    Field Format Description Required
    dscAdAccount Sponsored Account URN The Ad Account that created the Direct Sponsored Content (DSC). Read-only This field is required when isDsc is true, optional otherwise.
    dscAdType String, Type of the content The type of DSC (e.g. VIDEO, STANDARD, CAROUSEL, etc.). Read-only This field is required when isDsc is true, optional otherwise.
    dscName String Plain text name of the DSC post. Only applicable for DSC. If isDSC is true and dscName is empty, it has an optional name Optional
    dscStatus String The status of the advertising company content. Representing whether the content is usable from the advertiser's perspective as a DSC. This field is required when isDsc is true; optional otherwise.
    isDsc boolean Whether or not this post is DSC. A posted DSC is created for the sole purpose of sponsorship. Read-only optional

    dscAdType

    The post's ad content type.

    Enumeration Name Description
    VIDEO Video content
    STANDARD Single image, text, or article
    CAROUSEL Carousel. Post contains a reference to a collection where the collection can only be images.
    JOB_POSTING Single content containing a LinkedIn job posting
    NATIVE_DOCUMENT Native document uploaded to LinkedIn. The following file types are supported: PPT, PPTX, DOC, DOCX, and PDF.
    EVENT Single content containing a LinkedIn event

    dscStatus

    Enables you to toggle the status of the advertising company content. It indicates whether the content is usable from the advertiser's perspective.

    Enumeration Name Description
    ACTIVE The content can be served.
    ARCHIVED The content is inactive and not intended for use, its creatives are cancelled. Archiving currently cannot be undone

    Content

    Field Format Description
    media MediaContent Details of the Media content such as Image, Video
    poll PollContent Details of Poll content (can only be non-sponsored)
    multiImage MultiImageContent Details of MultiImage content (can only be non-sponsored)
    article ArticleContent Details of Article content (can be either non-sponsored or sponsored)
    carousel CarouselContent Details of Carousel content (Can only be sponsored)
    celebration CelebrationContent Details of Celebration content (can only be non-sponsored and currently, celebration post cannot be created through external api)
    reference ReferenceContent Details of Reference content like event and appreciation.

    Reference

    Field Format Description
    id URN The URN of the reference that represents a reference such as an event (e.g. urn:li:reference:123).

    Media

    Field Format Description
    id URN The URN of the media such as image or video.
    title String Optional The media title. No title if empty.
    altText String Optional The alternate text for the media. None if empty.

    distribution

    Field Format Description
    feedDistribution feedDistribution type Specifies the feeds distributed to within LinkedIn.
  • NONE-Do not distribute within LinkedIn via feed.
  • MAIN_FEED-Distribute to the flagship feed, and container entity feed if applicable.
  • targetEntities Optional target Intended audience for this post. The target entities targeted for distribution. The distribution is an OR of the targets in the array.
    thirdPartyDistributionChannels Optional External distribution channels that this post is distributed to (e.g., Twitter, Tencent, Weibo). Empty array indicates the post is not externally distributed.

    targetEntities

    Field Sub-Field Format Description
    targetedEntities Entities targeted for distribution. Structured as an object containing multiple arrays of targeting entity URNs that function like a series of OR conditionals. Array of Targets (see below)
    degrees Standardized degrees to be targeted. Array of Degree URN
    fieldsOfStudy Standardized fields of study to be targeted. Array of FieldOfStudy URN
    industries Industries to be targeted. Array of Industry URN
    interfaceLocales Interface locales to be targeted. Array of Locale
    jobFunctions Top level groupings of super titles to be targeted. Array of Function URN
    locations Deprecated. Use geoLocations field instead for the targeting location. URNs can be: countryGroup, country, state, and region Array of Location URN
    geoLocations GeoLocations for targeting. Array of Geo URN Learn more
    schools Deprecated. Use organizations field instead. Standardized schools for targeting. Array of School URN
    organizations School organizations for targeting. You can retrieve a school organization URN using the Organization Lookup API Array of Organization URN
    seniorities Seniorities to be targeted Array of Seniority URN
    staffCountRanges Organization sizes for targeting. Consists of the following enum values:
  • SIZE_1
  • SIZE_2_TO_10
  • SIZE_11_TO_50
  • SIZE_51_TO_200
  • SIZE_201_TO_500
  • SIZE_501_TO_1000<
  • SIZE_1001_TO_5000
  • SIZE_5001_TO_10000
  • SIZE_10001_OR_MORE
  • Array of StaffCountRange

    Note

    The audience you target for your share must be greater than 300 members. See Create Targeted Organic Posts for more information.

    lifecycleStateInfo

    This section provides additional information about the lifecycle state.

    Field Format Description
    contentStatus optional ProcessingState Status for post content. If absent, then state does not wait for content processing. PENDING, PROCESSING, and FAILED are available values. If processing completes UGC transitions to PUBLISHED and the contentStatus is null.
    isEditedByAuthor boolean
    default=false Indicates whether a post was edited by the author after publishing. Applicable for UserGeneratedContentLifecycleState value of PUBLISHED only.
    reviewStatus optional ProcessingState Review status of the post. If not present, then the state does not wait upon review. PENDING, PROCESSING, and FAILED are the possible values for this field. If processing completes the UGC transitions to PUBLISHED and reviewStatus is null. Applicable for lifecycle state values of PUBLISH_REQUESTED and PUBLISHED_FAILED only.

    Create a Post

    Create Organic Posts

    Text-Only Post Creation Sample Request

    Note

    Ensure you include the request header "Content-Type": "application/json"

    POST https://api.linkedin.com/rest/posts
    
    {
      "author": "urn:li:organization:5515715",
      "commentary": "Sample text Post",
      "visibility": "PUBLIC",
      "distribution": {
        "feedDistribution": "MAIN_FEED",
        "targetEntities": [],
        "thirdPartyDistributionChannels": []
      },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false
    }
    

    You should get a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Single Post Creation Sample Request

    Creating posts with image requires uploading an image asset to obtain a Image URN (urn:li:image:{id}) for creating the post. See the Images API for instructions on how to do this.

    Creating posts with video requires uploading a video asset to obtain a Video URN (urn:li:video:{id}) for creating the post. See the Videos API for instructions on how to do this.

    Creating posts with document requires uploading a document asset to obtain a Document URN (urn:li:document:{id}) for creating the post. See the Documents API for instructions on how to do this.

    If you want to create an organic (non-sponsored) post with multiple images, refer to MultiImage API. If you want to create a sponsored post with multiple images, refer to Carousel API.

    Note

    Make sure you include the request header "Content-Type": "application/json"

    POST https://api.linkedin.com/rest/posts
    
    {
      "author": "urn:li:organization:5515715",
      "commentary": "Sample video Post",
      "visibility": "PUBLIC",
      "distribution": {
        "feedDistribution": "MAIN_FEED",
        "targetEntities": [],
        "thirdPartyDistributionChannels": []
      },
      "content": {
        "media": {
          "title":"title of the video",
          "id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
        }
      },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false
    }
    

    You should get a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Poll Post Creation Sample Request

    You can only create non-sponsored poll posts. Please refer to Poll API.

    MultiImage Post Creation Sample Request

    You can only create non-sponsored multiImage posts. Multi-Image post is a post containing multiple images. Please refer to MultiImage API.

    Article Post Creation Sample Request

    Note

    Make sure you include the request header "Content-Type": "application/json"

    Posts API does not support url scraping for article post creation as it introduces level of unpredictability in how a post is going to look when API partners create it. Instead, API partners need to set article fields such as thumbnail, title and description within the post when creating an article post. To create an article post with thumbnail image, please use Images API to upload thumbnail image and use the ImageUrn on thumbnail field. For more info, please refer to ArticleContent API.

    POST https://api.linkedin.com/rest/posts
    
    {
     "author": "urn:li:organization:5515715",
     "commentary": "test article post",
     "visibility": "PUBLIC",
     "distribution": {
       "feedDistribution": "MAIN_FEED",
       "targetEntities": [],
       "thirdPartyDistributionChannels": []
     },
     "content": {
         "article": {
             "source": "https://lnkd.in/eabXpqi",
             "thumbnail": "urn:li:image:C49klciosC89",
             "title": "prod test title two",
             "description": "test description"
         }
     },
     "lifecycleState": "PUBLISHED",
     "isReshareDisabledByAuthor": false
    }
    

    You should get a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Carousel Post Creation Sample Request

    You can only create sponsored carousel post. Organic carousel is currently not supported. Please refer to Carousel API.

    Post Creation Response

    The Post is created with a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Reshare a post

    Note

    Make sure you include the request header "Content-Type": "application/json".
    Reshare creation is only supported for LinkedIn-Version 202209 and above. Using versions lower than 202209 will not allow reshare creation.

    Reshare Creation Request

    The following example reshares a post (urn:li:share:6957408550713184256) on the main feed. You must specify "reshareContext.parent" field as shown below for resharing that post. "reshareContext.root" is the greatest ancestor of the post - may also be the parent. This read-only field is derived from the parent.

    POST https://api.linkedin.com/rest/posts
    
    {
      "author": "urn:li:organization:5515715",
      "commentary": "Sample reshare post",
      "visibility": "PUBLIC",
      "distribution": {
        "feedDistribution": "MAIN_FEED",
        "targetEntities": [],
        "thirdPartyDistributionChannels": []
      },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false,
      "reshareContext": {
        "parent": "urn:li:share:6957408550713184256"
      }
    }
    

    Reshare Creation Sample Response

    The reshare is created with a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Reshare Get Response

    When you fetch a reshare post, it will look as below.

    {
      "author": "urn:li:organization:5515715",
      "commentary": "Sample reshare post",
      "visibility": "PUBLIC",
      "distribution": {
        "feedDistribution": "MAIN_FEED",
        "targetEntities": [],
        "thirdPartyDistributionChannels": []
      },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false,
      "reshareContext": {
        "parent": "urn:li:share:6957408550713184256",
        "root": "urn:li:share:6957408550713184256"
      }
    }
    

    Create Targeted Organic Posts

    To increase the engagement and impact of your message, you can target organizational posts to a subset of your followers. You select a target audience within your company's existing follower base by using predefined criteria known as targeting facets.

    Examples of possible targeting facets include geography, job function, industry, and seniority level. See Ads Targeting and Standardized Data to create a segment of a specific audience you want to target.

    The audience you target for your UGC Post must be greater than 300 members. Use the Audience Counts API to calculate the approximate size of your audience. Make sure to pass in your organization URN in the followedCompanies field of the targetingFacet parameter so your audience count is filtered down to only members who follow your company.

    Sample Request for Audience Count

    GET https://api.linkedin.com/rest/audienceCounts?q=targetingCriteria&target.includedTargetingFacets.industries[0]=urn:li:industry:4&target.includedTargetingFacets.seniorities[0]=urn:li:seniority:3&target.includedTargetingFacets.locations[0]=urn:li:geo:103644278&target.includedTargetingFacets.followedCompanies[0]=urn:li:organization:2414183
    

    Sample Response

    {
        "elements": [
            {
                "active": 0,
                "total": 380
            }
        ],
        "paging": {
            "count": 10,
            "links": [],
            "start": 0
        }
    }
    

    In this example, since the audience size is above 300, we can create a targeted organic UGC Post with the targeting details in the targetedEntities object. The targetedEntities object is structured as an array that accepts a single object. That object contains multiple targeting entity arrays. Each targeting facet array accepts targeting entity URNs. See the following sample request below for an example.


    Organic Targeted Post Creation Sample Request

    The sample request below is for an organic video post creation targeting urn:li:geo:103644278 (geo-target) and urn:li:seniority:3.

    Note

    Make sure you include the request header "Content-Type": "application/json"

    POST https://api.linkedin.com/rest/posts
    
    {
      "author": "urn:li:organization:5515715",
      "commentary": "Sample targeted video Post",
      "visibility": "PUBLIC",
      "distribution": {
        "feedDistribution": "MAIN_FEED",
        "targetEntities": [{
                    "geoLocations": [
                        "urn:li:geo:103644278"
                    ],
                    "seniorities": [
                        "urn:li:seniority:3"
                    ]
                }],
        "thirdPartyDistributionChannels": []
      },
      "content":{
        "media":{
          "title":"title of the video",
          "id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
          }
        },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false
    }
    

    Create Dark Posts

    Dark posts are used to create content that does not appear as organic content on a LinkedIn company page. Dark posts can be used in Ad Campaigns as DSC. See Direct Sponsored Content Overview for more information.

    You can create a dark post using an author as an organization urn:li:organization:{id}, visibility as PUBLIC, feedDistribution as NONE, and setting details of the adContext type.

    Dark posts can be created as inline posts for usage in an ad campaign. See Video Ads for more details.

    When a UGC Post is published ("lifecycleState": "PUBLISHED"), an authorized member can view the post using the follow URL structure:

    https://www.linkedin.com/feed/update/urn:li:ugcPost:<id>/

    Get Posts by URN

    To retrieve posts, use URNs such as: ugcPostUrn (urn:li:ugcPost:{id}) or shareUrn (urn:li:share:{id}).

    Note

    You can also provide an optional parameter, viewContext to all GET, BATCH_GET and Finders to retrieve posts. By default, viewContext is READER, which specifies the version of the post that has been published and is viewable to a general audience.

    The AUTHOR viewContext can be used to retrieve the latest version of a post, which may have not yet been published; it may be in a number of possible states such as PUBLISHED, DRAFT or PROCESSING.

    Note

    Use the Images API and Videos API to retrieve additional details about image and video assets such as the downloadUrl for article thumbnails.

    Note

    URNs included in the URL params must be URL encoded. For example, urn:li:ugcPost:12345 would become urn%3Ali%3AugcPost%3A12345.

    Sample Request

    GET https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
    

    If your request exceeds the maximum length requirement, please utilize query tunneling:

    curl -X POST 'https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn} \
    -H 'Authorization: Bearer redacted' \
    -H 'X-Restli-Protocol-Version: 2.0.0' \
    -H 'LinkedIn-Version: {version number in the format YYYYMM}' \
    --data 'viewContext=AUTHOR'
    

    Sample Response

    {
      "lifecycleState": "PUBLISHED",
      "lastModifiedAt": 1634790968774,
      "visibility": "PUBLIC",
      "publishedAt": 1634790968774,
      "author": "urn:li:organization:5515715",
      "distribution": {
        "feedDistribution": "NONE",
        "thirdPartyDistributionChannels": []
      },
      "content": {
        "media": {
          "id": "urn:li:video:C5F10AQGKQg_6y2a4sQ"
        }
      },
      "lifecycleStateInfo": {
        "isEditedByAuthor": false
      },
      "isReshareDisabledByAuthor": false,
      "createdAt": 1634790968743,
      "id": "urn:li:ugcPost:6856810298419044352",
      "commentary": "comment on Oct 20",
      "adContext": {
        "dscStatus": "ACTIVE",
        "dscAdType": "VIDEO",
        "isDsc": true,
        "dscAdAccount": "urn:li:sponsoredAccount:520866471"
      }
    }
    

    Batch Get Posts

    Multiple posts can be retrieved and viewed in a single API call by passing in multiple UGC Posts or share URNs into the ids parameter. The UGC Post URNs should be passed in List format and should be encoded as shown in the examples below. Note that the , in the List separating each URN does not need to be encoded.

    Note

    Make sure to add header X-RestLi-Method with value of BATCH_GET in the request.

    Sample Request

    GET https://api.linkedin.com/rest/posts?ids=List({encoded ugcPostUrn},{encoded ugcPostUrn})
    

    Sample Response

    {
        "results": {
            "urn:li:share:6844785523593134080": {
                "lifecycleState": "PUBLISHED",
                "lastModifiedAt": 1631924039162,
                "visibility": "PUBLIC",
                "publishedAt": 1631924038940,
                "author": "urn:li:organization:5515715",
                "distribution": {
                    "feedDistribution": "NONE",
                    "thirdPartyDistributionChannels": []
                },
                "content": {},
                "lifecycleStateInfo": {
                    "isEditedByAuthor": false
                },
                "isReshareDisabledByAuthor": true,
                "createdAt": 1631924038940,
                "id": "urn:li:share:6844785523593134080",
                "commentary": "Test Org commentary-Updated Config"
            }
        },
        "statuses": {},
        "errors": {}
    }
    

    Find Posts by Authors

    You can retrieve all posts for an organization using the following parameters. Prior to 202301, only organization URN as author is supported. For LinkedIn-Version 202301 and above, it supports both person URN and organization URN as author param for author finder.

    By default, all Posts API finder results are sorted by post last modified time (lastModifiedAt field) in descending order (latest to oldest). You can configure this using the optional sortBy param.

    Note

    Author finder by person URN is only supported for <LinkedIn-Version 202301> and above. Using versions lower than 202301 causes failure.

    Field Description Format Required
    author URN: author of the post Posts author - Person URN or Organization URN Required
    viewContext enum READER or AUTHOR - Default=READER The viewContext in which you are looking at the posts. Use AUTHOR when viewing post as the author of the post and READER when viewing post as the a non-author. Optional
    start The index of the first item you want results for. Default=0 int Optional
    count The number of items you want included on each page of results. There could be fewer items remaining than the value you specify. The default is 10 and maximum allowed count is 100. int Optional
    sortBy The sort order for the results in descending order. LAST_MODIFIED (for last modified time) or CREATED (for created time). Default is set to LAST_MODIFIED enum - LAST_MODIFIED or CREATED Optional

    You can also provide an optional parameter, viewContext. By default, viewContext is READER, which specifies the version of the post that has been published and is viewable to a general audience.

    isDsc parameter is deprecated and will be rejected with version 202301 and above. Previously, isDsc=true returned sponsored posts only and isDsc=false returned both organic and sponsored posts. Now, by default, it will return both organic and sponsored posts together (same behaviour as isDsc=false). This matches the legacy /ugcPosts author finder endpoint's behavior.

    Note

    You can receive less than the count number of results in a page, when there are more posts available in the following pages. The links field in the response will provide a link to the next page for more posts.

    Sample Request

    • To retrieve all posts authored by a person. The r_member_social permission and LinkedIn-Version 202301 or above are required.

    • To retrieve all posts authored by an organization. The r_organization_social permission is required.

    GET https://api.linkedin.com/rest/posts?author={encoded person urn or organization urn like urn%3Ali%3Aperson%3A5abc_dEfgH or urn%3Ali%3Aorganization%3A2414183}&q=author&count=10&sortBy=LAST_MODIFIED
    

    Sample Response

    {
      "paging": {
        "start": 0,
        "count": 10,
        "links": []
      },
      "elements": [
        {
          "lifecycleState": "PUBLISHED",
          "lastModifiedAt": 1634817395768,
          "visibility": "PUBLIC",
          "publishedAt": 1634817394721,
          "author": "urn:li:organization:2414183",
          "distribution": {
            "feedDistribution": "MAIN_FEED",
            "thirdPartyDistributionChannels": []
          },
          "content": {},
          "lifecycleStateInfo": {
            "isEditedByAuthor": false
          },
          "isReshareDisabledByAuthor": false,
          "createdAt": 1634817394721,
          "id": "urn:li:share:6856921137721544704",
          "commentary": ""
        },
        {
          "lifecycleState": "PUBLISHED",
          "lastModifiedAt": 1634814069101,
          "visibility": "PUBLIC",
          "publishedAt": 1634813460041,
          "author": "urn:li:organization:2414183",
          "distribution": {
            "feedDistribution": "MAIN_FEED",
            "thirdPartyDistributionChannels": []
          },
          "lifecycleStateInfo": {
            "isEditedByAuthor": false
          },
          "isReshareDisabledByAuthor": false,
          "createdAt": 1634813460041,
          "id": "urn:li:share:6856904634360066048",
          "commentary": ""
        }
      ]
    }
    

    Find Posts by Account

    You can retrieve all posts with the specific Sponsored Account and the content types with the following parameters:

    Field Description Format Required
    dscAdAccount URN: Sponsored Ad Account URN of the DSC Ad Account associated with a post Required
    viewContext enum READER or AUTHOR - Default=READER viewContext in which you are looking at the posts Optional
    dscAdTypes record of list dscAdType DSC ad types to search for Optional

    Sample Request

    GET https://api.linkedin.com/rest/posts?dscAdAccount={encode dscAdAccount}&q=dscAdAccount&dscAdTypes=List(STANDARD,VIDEO)
    

    Sample Response

    {
      "paging": {
        "start": 0,
        "count": 10,
        "links": []
      },
      "elements": [
        {
          "lifecycleState": "PUBLISHED",
          "lastModifiedAt": 1634817395768,
          "visibility": "PUBLIC",
          "publishedAt": 1634817394721,
          "author": "urn:li:organization:2414183",
          "distribution": {
            "feedDistribution": "MAIN_FEED",
            "thirdPartyDistributionChannels": []
          },
          "content": {},
          "lifecycleStateInfo": {
            "isEditedByAuthor": false
          },
          "isReshareDisabledByAuthor": false,
          "createdAt": 1634817394721,
          "id": "urn:li:share:6856921137721544704",
          "commentary": ""
        },
        {
          "lifecycleState": "PUBLISHED",
          "lastModifiedAt": 1634814069101,
          "visibility": "PUBLIC",
          "publishedAt": 1634813460041,
          "author": "urn:li:organization:2414183",
          "distribution": {
            "feedDistribution": "MAIN_FEED",
            "thirdPartyDistributionChannels": []
          },
          "lifecycleStateInfo": {
            "isEditedByAuthor": false
          },
          "isReshareDisabledByAuthor": false,
          "createdAt": 1634813460041,
          "id": "urn:li:share:6856904634360066048",
          "commentary": ""
        }
      ]
    }
    

    Update Posts

    When you perform an update, the header X-RestLi-Method must be included in the request and set to PARTIAL_UPDATE.

    Note

    All APIs require the request header Content-Type: application/json

    Only the following posts fields below are available to update through the Posts API.

    Field Description
    commentary The user generated commentary of this post in little format
    contentCallToActionLabel The call to action label that a member can act on that opens a landing page, that can be associated with the content. If empty, then there is no call to action associated with the content
    contentLandingPage URL of the landing page
    lifecycleState The state of the content. PUBLISHED is the only accepted field during creation. The following values can be returned in responses:
  • DRAFT - Represents content that is accessible only to the author and is not yet published.
  • PUBLISHED - Represents content that is accessible to all entities. This is the only accepted field during creation.
  • PUBLISH_REQUESTED - Represents content that has been submitted for publishing but is not yet ready for rendering. The content will be published asynchronously once the processing has successfully completed.
  • PUBLISH_FAILED - Represents content that has been submitted for publishing but was not processed. An edit is required in order to re-attempt publishing.
  • adContext
  • dscName: Update the name of the sponsored content
  • dscStatus: Update the status of the sponsored content
  • POST 'https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}' 
    
    {
        "patch":
        {
            "$set":
            {
                "commentary": "Update to the post",
                "contentCallToActionLabel": "LEARN_MORE"
            },
            "adContext":
            {
                "$set":
                {
                    "dscName": "Updating name!"
                }
            }
        }
    }
    

    A successful response returns a 204 code.

    Delete Posts

    Post deletions are idempotent. Deletion requests for a previously deleted UGC Post will return a 204 code - No Content.

    Important

    Batch delete of Posts is not supported.

    Sample Request

    DELETE https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
    

    A successful response returns a 204 code notification.

    Mentions and Hashtags using Posts commentary

    The Posts API has a commentary field that can be used to mention or hashtag of other Linkedin entities such as organizations or members. Specifying an annotation requires providing the URN for the referenced entity, and specifying what part of the text should be rendered as a link to the entity.

    The text linking to the annotated entity must match the name of the member or organization for link conversion. Matching is case sensitive. If there is no match, text appears as normal text. This includes cases where the provided text length is longer or shorter than the name of the member or organization. The exception to this is member annotations. Member annotations only need to match one name in the full text naming. For example, consider the name "Jane Smith". A share can match either on "Jane", "Smith", or "Jane Smith".

    Organization mentions can be schools (such as Universities), organization brands (previously known as Showcase Pages), and Organizations (companies). Organization annotations must match the full name.

    Sample Objects

    Organization URN Examples
    • urn:li:organization:11832 (School - Boise State University)
    • urn:li:organization:2414183 (Organization - Devtestco)

    Mention an Organization

    In the following example, Devtestco is being tagged.

    POST https://api.linkedin.com/rest/posts
    
    {
      "author": "urn:li:organization:123456789",
      "commentary": "Hello @[Devtestco](urn:li:organization:2414183)",
      "visibility": "PUBLIC",
      "distribution": {
          "feedDistribution": "MAIN_FEED",
          "targetEntities": [],
          "thirdPartyDistributionChannels": []
      },
      "lifecycleState": "PUBLISHED",
      "isReshareDisabledByAuthor": false
    }
    

    The Post is created with a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Get Posts by URN For above mentioned Organization

    To retrieve posts, use URNs such as: ugcPostUrn (urn:li:ugcPost:{id}) or shareUrn (urn:li:share:{id}) as shown in the previous example post.

    Sample Request

    GET https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
    

    Sample Response

    {
       "isReshareDisabledByAuthor": false,
       "createdAt": 1636669884769,
       "lifecycleState": "PUBLISHED",
       "lastModifiedAt": 1636669884769,
       "visibility": "PUBLIC",
       "publishedAt": 1636669884769,
       "author": "urn:li:organization:18799005",
       "id": "urn:li:share:6864691044148133888",
       "distribution": {
           "feedDistribution": "MAIN_FEED",
           "thirdPartyDistributionChannels": []
       },
       "commentary": "Hello @[Devtestco](urn:li:organization:2414183)",
       "lifecycleStateInfo": {
           "isEditedByAuthor": false
       }
    }
    

    Note how organization mention data is returned in the commentary field.

    Hashtag a keyword

    In the following example, coding is being tagged.

    POST https://api.linkedin.com/rest/posts
    
    {
       "author": "urn:li:organization:123456789",
       "commentary": "Follow best practices #coding",
       "visibility": "PUBLIC",
       "distribution": {
           "feedDistribution": "MAIN_FEED",
           "targetEntities": [],
           "thirdPartyDistributionChannels": []
       },
       "lifecycleState": "PUBLISHED",
       "isReshareDisabledByAuthor": false
    }
    

    The Post is created with a 201 response and the response header x-restli-id contains the Post ID such as urn:li:share:6844785523593134080 or urn:li:ugcPost:68447855235931240.

    Get Posts by URN For above Hashtag of the keyword

    To retrieve posts, use URNs such as: ugcPostUrn (urn:li:ugcPost:{id}) or shareUrn (urn:li:share:{id}) from the previous created post example.

    Sample Request

    GET https://api.linkedin.com/rest/posts/{encoded ugcPostUrn|shareUrn}
    

    Sample Response

    {
       "isReshareDisabledByAuthor": false,
       "createdAt": 1636688348505,
       "lifecycleState": "PUBLISHED",
       "lastModifiedAt": 1636688348559,
       "visibility": "PUBLIC",
       "publishedAt": 1636688348505,
       "author": "urn:li:organization:18799005",
       "id": "urn:li:share:6864768486615375872",
       "distribution": {
           "feedDistribution": "MAIN_FEED",
           "thirdPartyDistributionChannels": []
       },
       "commentary": "Follow best practices {hashtag|\\#|coding}",
       "lifecycleStateInfo": {
           "isEditedByAuthor": false
       }
    }
    

    Note how the commentary field hashtag data is returned with a template. To learn more about the hashtag template refer to little Text Format for more information.

    Enable or Disable Comments Section on a Post

    To enable or disable comment section on a post, refer to Social Metadata API using share or UGC URN.