Poll API

Warning

Deprecation Notice
The Marketing version 202304 (Marketing April 2023) and below has been sunset and the unversioned APIs are going to 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 LinkedIn Poll API helps you engage with other members by asking them for their perspectives about various topics. Polls help you understand trends and opinions and can be a great conversation starter. You can now create and manage Polls content using the Posts API. Updating poll content is not allowed.

Duration of the poll can be one day (ONE_DAY), three days (THREE_DAYS), one week (SEVEN_DAYS) or two weeks (FOURTEEN_DAYS). The author of the poll will be able to view who voted and how each person voted. In addition, the author will be able to view aggregate results displayed in a percentage format and the number of votes per option. When a poll is created by a LinkedIn Page, all Admins of that Page will be able to see who voted and how each person voted. The poll can have a minimum of 2 poll options and a maximum of 4 poll options.

API partners can only create non-sponsored poll posts.

Note

Poll authors may not ask for political opinions, health status, or other sensitive data. Poll authors must adhere to LinkedIn’s standard terms, including our "Do's and Don'ts" and Professional Community Policies.


Learn more about creating a LinkedIn Poll on LinkedIn web or mobile & frequently asked questions about LinkedIn Polls.

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

    Poll

    Field Format Description Required
    question String Question for the poll. Max length of 140 characters. create-only required
    settings PollSettings type Settings related to the poll, such as when it's closed for voting and how many options can be selected for votes. create-only required
    options array of PollOptions Options for the poll. There must be at least two. Maximum 4 options. required
    uniqueVotersCount long Number of unique voters on the poll. Defaults to 0. read-only optional

    PollSettings

    Field Format Description Required
    voteSelectionType
  • SINGLE_VOTE - Single-select vote.
  • MULTIPLE_VOTE - Multiple-select vote (To be supported later in future)
  • The selection type of votes on the poll. Defaults to SINGLE_VOTE. optional
    duration Type of PollDuration which has the values of:
  • ONE_DAY - Poll is open for 1 day
  • THREE_DAYS - Poll is open for 3 days
  • SEVEN_DAYS - Poll is open for 7 days
  • FOURTEEN_DAYS - Poll is open for 14 days
  • Duration of poll being open for votes. It will close after the specified duration from creation time. required
    isVoterVisibleToAuthor boolean. Currently, isVoterVisibleToAuthor=false is not supported. If isVoterVisibileToAuthor=false, it will throw 400. Poll author’s visibility to voters. Defaults to true optional

    PollOption

    Field Format Description Required
    text String Text describing the option. Maximum length of 30 characters. required
    isVotedByViewer boolean Boolean value to show whether the viewer voted this poll option. Defaults to false. read-only optional
    voteCount long Vote counts of the poll option. Missing if the viewer of the poll is not allowed to view votes count on individual options based on visibility rules (e.g. viewer has not already voted on the poll). read-only optional

    Create Poll content

    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 poll",
     "visibility": "PUBLIC",
     "distribution": {
       "feedDistribution": "MAIN_FEED",
       "targetEntities": [],
       "thirdPartyDistributionChannels": []
     },
     "lifecycleState": "PUBLISHED",
     "isReshareDisabledByAuthor": false,
     "content": {
         "poll": {
           "question" :"What is your favorite color?",
           "options" : [ { "text" : "Red" }, { "text" : "Blue" }, {"text": "Yellow"}, {"text": "green"} ],
           "settings" : { "duration" : "THREE_DAYS" }
         }
     }
    }
    

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

    Get Poll 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": 1650909170969,
       "lifecycleState": "PUBLISHED",
       "lastModifiedAt": 1650909170969,
       "visibility": "PUBLIC",
       "publishedAt": 1650909170969,
       "author": "urn:li:organization:2414183",
       "id": "urn:li:ugcPost:6924414938606112768",
       "distribution": {
           "feedDistribution": "MAIN_FEED",
           "thirdPartyDistributionChannels": []
       },
       "content": {
           "poll": {
               "options": [
                   {
                       "isVotedByViewer": false,
                       "voteCount": 0,
                       "text": "Red"
                   },
                   {
                       "isVotedByViewer": false,
                       "voteCount": 0,
                       "text": "Blue"
                   },
                   {
                       "isVotedByViewer": false,
                       "voteCount": 0,
                       "text": "Yellow"
                   },
                   {
                       "isVotedByViewer": false,
                       "voteCount": 0,
                       "text": "green"
                   }
               ],
               "settings": {
                   "voteSelectionType": "SINGLE_VOTE",
                   "duration": "THREE_DAYS",
                   "isVoterVisibleToAuthor": true
               },
               "uniqueVotersCount": 0,
               "question": "What is your favorite color?"
           }
       },
       "commentary": "test poll",
       "lifecycleStateInfo": {
           "isEditedByAuthor": false
       }
    }
    

    Batch Get Poll content

    Sample Request

    Note

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

    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 Poll content and the other with Carousel content.

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

    Sample Response

    {
       "results": {
           "urn:li:ugcPost:6924414938606112768": {
               "isReshareDisabledByAuthor": false,
               "createdAt": 1650909170969,
               "lifecycleState": "PUBLISHED",
               "lastModifiedAt": 1650909170969,
               "visibility": "PUBLIC",
               "publishedAt": 1650909170969,
               "author": "urn:li:organization:2414183",
               "id": "urn:li:ugcPost:6924414938606112768",
               "distribution": {
                   "feedDistribution": "MAIN_FEED",
                   "thirdPartyDistributionChannels": []
               },
               "content": {
                   "poll": {
                       "options": [
                           {
                               "isVotedByViewer": false,
                               "voteCount": 0,
                               "text": "Red"
                           },
                           {
                               "isVotedByViewer": false,
                               "voteCount": 0,
                               "text": "Blue"
                           },
                           {
                               "isVotedByViewer": false,
                               "voteCount": 0,
                               "text": "Yellow"
                           },
                           {
                               "isVotedByViewer": false,
                               "voteCount": 0,
                               "text": "green12"
                           }
                       ],
                       "settings": {
                           "voteSelectionType": "SINGLE_VOTE",
                           "duration": "THREE_DAYS",
                           "isVoterVisibleToAuthor": true
                       },
                       "uniqueVotersCount": 0,
                       "question": "What is your favorite color?"
                   }
               },
               "commentary": "test poll",
               "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.linkedin.com/",
                               "media": {
                                   "title": "first card",
                                   "taggedEntities": [],
                                   "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                               }
                           },
                           {
                               "landingPage": "http://www.linkedin.com/",
                               "media": {
                                   "title": "second card",
                                   "taggedEntities": [],
                                   "id": "urn:li:image:C4E22AQGX_uq7mQBfAA"
                               }
                           }
                       ]
                   }
               },
               "lifecycleStateInfo": {
                   "isEditedByAuthor": false
               },
               "contentLandingPage": "http://www.linkedin.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