Partager via


MultiImage 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.

You can create and manage MultiImage content inline using the Posts API. A MultiImage post is a post containing multiple images (minimum of 2 images and maximum of 9 images). Please ensure that all images being used are owned by the author or organization.

You can create and manage MultiImage content inline using the Posts API. A MultiImage post is a post containing multiple images (minimum of 2 images and maximum of 20 images). Please ensure that all images being used are owned by the author or organization.

API partners can only create non-sponsored multiImage posts.

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.

    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

    Prerequisites for the API

    Please check the Posts API for more information.

    Schema

    MultiImage

    Field Format Description Required
    images array of Media The array of images in the MultiImage content. Only supports images (type urn:li:image:{id}). Minimum of 2 images and maximum of 9 images required
    altText String The alternate text of this thumbnail. Used for screen reader accessibility. Maximum length is 4086 characters, recommended length is less than 120 characters. Optional
    Field Format Description Required
    images Array of Media The array of images in the MultiImage content. Only supports images (type urn:li:image:{id}). Minimum of 2 images and maximum of 20 images. Required
    altText String The alternate text of this thumbnail. Used for screen reader accessibility. Maximum length is 4086 characters, recommended length is less than 120 characters. Optional

    The MultiImage API supports the following image pixel count and formats:

    • Images with less than 36152320 pixels.
    • JPG, GIF, and PNG formats.
    • GIF format supports up to 250 frames.

    Create MultiImage content

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

    Sample Request

    Note

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

    POST https://api.linkedin.com/rest/posts
    
    {
        "author": "urn:li:organization:2414183",
        "commentary": "test multiimage post",
        "visibility": "PUBLIC",
        "distribution": {
            "feedDistribution": "MAIN_FEED",
            "targetEntities": [],
            "thirdPartyDistributionChannels": []
        },
        "lifecycleState": "PUBLISHED",
        "isReshareDisabledByAuthor": false,
        "content": {
            "multiImage": {
                "images": [
                    {
                        "id": "urn:li:image:C4D22AQFttWMAaIqHaa",
                        "altText": "testing for alt tags1"
                    },
                    {
                        "id": "urn:li:image:C4D22AQG7uz0yPJh588",
                        "altText": "testing for alt tags2"
                    }
                ]
            }
        }
    }
    

    A successful response returns a 201 Created HTTP status code and the ID in the x-linkedin-id response header.

    Get MultiImage content

    Sample Request

    Note

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

    GET https://api.linkedin.com/rest/posts
    

    A successful response returns a 200 HTTP status code and payload.

    Sample Response

    {
       "isReshareDisabledByAuthor": false,
       "createdAt": 1649459602344,
       "lifecycleState": "PUBLISHED",
       "lastModifiedAt": 1649459602436,
       "visibility": "PUBLIC",
       "publishedAt": 1649459602344,
       "author": "urn:li:organization:2414183",
       "id": "urn:li:ugcPost:6918335007103016960",
       "distribution": {
           "feedDistribution": "MAIN_FEED",
           "thirdPartyDistributionChannels": []
       },
       "content": {
           "multiImage": {
               "images": [
                   {
                       "taggedEntities": [],
                       "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                   },
                   {
                       "taggedEntities": [],
                       "id": "urn:li:image:C5522AQHGz_XcBZz95Q"
                   }
               ]
           }
       },
       "commentary": "test multiimage post",
       "lifecycleStateInfo": {
           "isEditedByAuthor": false
       }
    }
    

    Batch Get MultiImage content

    You can also fetch multiple posts with different types of content by providing multiple post IDs. The example response shows a Batch Get response for two posts, one with MultiImage content and the other with Carousel content.

    Sample Request

    Note

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

    POST https://api.linkedin.com/rest/posts?ids={encoded postId}&ids={encoded postId}
    

    Sample Response

    {
         "results": {
           "urn:li:ugcPost:6924414938606112768": {
               "isReshareDisabledByAuthor": false,
               "createdAt": 1649459602344,
               "lifecycleState": "PUBLISHED",
               "lastModifiedAt": 1649459602436,
               "visibility": "PUBLIC",
               "publishedAt": 1649459602344,
               "author": "urn:li:organization:2414183",
               "id": "urn:li:ugcPost:6918335007103016960",
               "distribution": {
                   "feedDistribution": "MAIN_FEED",
                   "thirdPartyDistributionChannels": []
               },
               "content": {
                   "multiImage": {
                       "images": [
                           {
                               "taggedEntities": [],
                               "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                           },
                           {
                               "taggedEntities": [],
                               "id": "urn:li:image:C5522AQHGz_XcBZz95Q"
                           }
                       ]
                   }
               },
               "commentary": "test multiimage post",
               "lifecycleStateInfo": {
                   "isEditedByAuthor": false
               }
           },
           "urn:li:ugcPost:6914373086788128769": {
               "lifecycleState": "PUBLISHED",
               "lastModifiedAt": 1648516563685,
               "visibility": "PUBLIC",
               "publishedAt": 1648515006906,
               "author": "urn:li:organization:2414183",
               "distribution": {
                   "feedDistribution": "NONE",
                   "thirdPartyDistributionChannels": []
               },
               "content": {
                   "carousel": {
                       "cards": [
                           {
                               "landingPage": "http://www.ddrfreak.com/",
                               "media": {
                                   "title": "first card",
                                   "taggedEntities": [],
                                   "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                               }
                           },
                           {
                               "landingPage": "http://www.ddrfreak.com/",
                               "media": {
                                   "title": "second card",
                                   "taggedEntities": [],
                                   "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                               }
                           }
                       ]
                   }
               },
               "lifecycleStateInfo": {
                   "isEditedByAuthor": false
               },
               "contentLandingPage": "http://www.ddrfreak.com/contentLandingPage",
               "isReshareDisabledByAuthor": false,
               "createdAt": 1648515006906,
               "id": "urn:li:ugcPost:6914373086788128769",
               "commentary": "test strings",
               "adContext": {
                   "dscStatus": "ACTIVE",
                   "dscAdType": "CAROUSEL",
                   "isDsc": true,
                   "dscAdAccount": "urn:li:sponsoredAccount:508915158"
               }
           }
       },
       "statuses": {
           "urn:li:ugcPost:6924414938606112768": 200,
           "urn:li:ugcPost:6914373086788128769": 200
       },
       "errors": {}
    }
    

    References