Skip to content

LinkedIn Comments API: List, Reply, and Delete Comments

The LinkedIn Comments API lets you list, reply to, and delete comments on LinkedIn posts programmatically, as a person or a company Page. This guide preserves the exact request shapes for listing comments, posting a top-level comment, replying to a comment, and deleting a comment, including the accountId, postId, and commentId fields you need to pass on each call.

What you need and input contract

You need an account with an access key, a LinkedIn member account, or a company Page you administer. Every request uses the x-access-key header, so treat the key like a password and never commit it to source control. Before writing comment code, confirm which connected account you will act as, because the accountId you pass determines whether comments are posted as you or on behalf of a company Page.

Get your API key

Open the Access Keys page in your dashboard and copy your access key. Send it on every request as the x-access-key header. If a request fails with an authentication error, check first that the header name is spelled exactly x-access-key and that the key value has no surrounding quotes or whitespace copied from the dashboard.

Connect your LinkedIn account

Request an authorization URL from the connect endpoint, open that URL in a browser, and authorize the app on the consent screen. The consent screen lists the comment permissions, which are the Community Management social-feed scopes needed for reading and writing comments, separate from the posting scope w_member_social. If you connected the LinkedIn account before comment support existed, its token predates those scopes, so reconnect the account once to grant them; posting and analytics keep working in the meantime, and only comments need the fresh token. After authorizing, call the integrations endpoint and read the id for the connected account. That id is the accountId for every comment call below. You do not build the actor URN yourself: a company Page account posts comments on behalf of that Page, and a member account posts as you.

List comments on a post

For a read, supply three query values: platform set to linkedin, your accountId, and a postId identifying the target. On LinkedIn that identifier takes share-URN form, illustrated by urn:li:share:7503693751647723520. A successful reply carries success, a comments array, and nextCursor for paging. Individual entries expose a composite identifier in id — urn:li:comment:(urn:li:activity:7503693773307224065,7506340885752803328) — together with text, author, timestamp, likeCount, hidden, and replies. Preserve that identifier verbatim for later reply or removal operations; encoding is handled downstream. Pages default to 25 entries, adjustable through limit within 1 to 100. Drilling into one thread means substituting a comment URN for the share URN in postId. A 403 response about lacking permission usually points to absent Community Management scopes, remedied by reconnecting rather than reshaping the call.

Post a top-level comment

Creating a standalone entry means sending POST to the comments endpoint carrying platform, accountId, postId, and text. Success yields a commentId holding the composite URN assigned to the new entry. A frequent workflow publishes the article first, then adds a resource link underneath to keep the main post uncluttered: obtain the share URN from the LinkedIn posting API and feed it in as postId. Verify the returned commentId before marking the operation done, and retain it when later steps may need to address that entry.

Reply to a comment

Nested responses share the same POST endpoint, with one substitution: commentId replaces postId. The former anchors a fresh standalone entry; the latter attaches beneath an existing entry. Supply platform, accountId, the composite URN obtained earlier, and text. The payload mirrors creation, returning success alongside the newly minted commentId. Automated responders follow this pattern — fetch entries, filter for relevant ones, then answer each using its stored commentId.

Delete a comment

Removal uses DELETE, embedding the composite URN in the URL path while platform and accountId travel as query values. A true success value confirms completion. This action cannot be undone: entries authored by your own identity vanish from view for all readers, and entries written by others on your post are likewise withdrawn from the thread. Automated moderation should therefore double-check the identifier against fetched results prior to issuing the call.

One thing LinkedIn can't do here

LinkedIn offers no hide or unhide capability through this interface, since that action is unavailable on its side. Moderation therefore narrows to two tools: answering and removing. Accordingly, the hidden property arrives as null rather than a boolean, reflecting the absence of any concealed state. Design moderation logic with that constraint in mind — answer to steer a conversation, remove to eliminate it.

What it costs

Budget by call count: listing, replying, and deleting each count as one Comments API call, so total usage is the sum of those operations for the volume you need. The source describes each Comments API call as spending 1 credit, the same as every other endpoint, so plan volume against that per-call figure. Before committing to a plan, record the current per-call credit cost and any included test allowance in your own notes: per-call credit cost: ______; included test credits: ______; expected monthly call volume: ______; resulting monthly credit total: ______. Treat those blanks as items to confirm with the account or billing owner rather than as published prices.

What's next

Together these operations cover the complete cycle: fetching entries and nested responses, adding standalone entries, answering within threads, and removing content for moderation. That foundation supports an inbox view, a first-comment workflow, or an automated answering flow tied to your LinkedIn presence. Begin with a fetch against a known post, confirm the returned URNs look right, then try a standalone entry and a nested answer before enabling removal in any automated process.

Input contract for LinkedIn comment calls
FieldUsed inRequired in source examplesMeaning
platformList, create, reply, deleteYes, value linkedinIdentifies LinkedIn as the target platform.
accountIdList, create, reply, deleteYesConnected account id from the integrations response; determines member versus company Page actor.
postIdList, top-level createYes for those callsShare URN of the target post; when listing replies, a comment URN is passed as postId.
commentIdReply, deleteYes for those callsComposite comment URN returned by list or create; used as the reply target or in the delete path.
textTop-level create, replyYesBody text of the new comment or reply.
limitListOptional, default 25, range 1 to 100Page size for listed comments.
nextCursorList responseResponse field, may be nullPagination cursor returned with the comments array.
x-access-keyAll calls (header)YesAccess key header authenticating every request.

Requiredness is stated exactly as shown in the source examples; no additional fields are invented.

Top-level comment versus reply versus delete
OperationMethod and pathTarget fieldResponse
List comments on a postGET /v1/commentspostId (share URN, or comment URN for replies)success, comments array, nextCursor
Post a top-level commentPOST /v1/commentspostId (share URN)success, commentId
Reply to a commentPOST /v1/commentscommentId (composite comment URN)success, commentId
Delete a commentDELETE /v1/comments/{commentId}commentId in path, plus platform and accountId query paramssuccess

Decision table comparing the three write/read operations in the source contract.

Field map for comment responses
FieldType in source exampleNotes
idstring (composite URN)Comment identifier; pass as commentId for reply or delete.
textstringComment body text.
author.idstring (URN)Author identifier, for example urn:li:person:ZSAPHe3Z55.
author.namestring or nullAuthor name; null in the source example.
timestampstring (ISO 8601)Comment timestamp, for example 2026-08-05T14:22:10Z.
likeCountnumberLike count on the comment.
hiddennull for LinkedInNo hidden state is reported for LinkedIn; there is no hide/unhide action.
repliesarrayNested replies; empty array in the source example.
nextCursorstring or nullPagination cursor; null when no further page is indicated in the example.
commentIdstring (composite URN)Returned by create and reply calls for the new comment.

Field map derived from the source list and create response examples.

Failure matrix for LinkedIn comment calls
Failure or limitationWhat you observeCheck or fix
403 permission error on comment callsAPI says you lack permissionComment calls need Community Management scopes (w_member_social_feed, w_organization_social_feed, r_organization_social_feed), separate from w_member_social; reconnect the account to grant them.
Stale token predating comment scopesPosting works but comments failReconnect the LinkedIn account once so its token includes the comment scopes.
Incorrect URN encodingAPI rejects the path or targetUse the full composite URN exactly as returned in id or commentId; do not rebuild or partially encode it.
hidden is nullNo true/false hidden stateExpected for LinkedIn: there is no hide/unhide action, so moderate with reply and delete only.
Wrong target fieldReply lands as a top-level comment or vice versaUse postId for a top-level comment and commentId for a nested reply; they are not interchangeable.

Failure matrix covering the scope, token, URN, and moderation limitations stated in the source.

Connect LinkedIn and obtain an authorization URL
curl {{API_BASE_URL}}/v1/connect/linkedin \
  -H "x-access-key: YOUR_API_KEY"
List connected integrations to find accountId
curl {{API_BASE_URL}}/v1/connect/integrations \
  -H "x-access-key: YOUR_API_KEY"
List comments on a LinkedIn post
curl "{{API_BASE_URL}}/v1/comments?platform=linkedin&accountId=your-li-id&postId=urn:li:share:7503693751647723520" \
  -H "x-access-key: YOUR_API_KEY"
List comments response example
{
  "success": true,
  "comments": [
    {
      "id": "urn:li:comment:(urn:li:activity:7503693773307224065,7506340885752803328)",
      "text": "An example comment.",
      "author": { "id": "urn:li:person:ZSAPHe3Z55", "name": null },
      "timestamp": "2026-08-05T14:22:10Z",
      "likeCount": 3,
      "hidden": null,
      "replies": []
    }
  ],
  "nextCursor": null
}
List nested replies by passing a comment URN as postId
curl "{{API_BASE_URL}}/v1/comments?platform=linkedin&accountId=your-li-id&postId=urn:li:comment:(urn:li:activity:7503693773307224065,7506340885752803328)" \
  -H "x-access-key: YOUR_API_KEY"
Post a top-level comment
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "linkedin",
    "accountId": "your-li-id",
    "postId": "urn:li:share:7503693751647723520",
    "text": "An example comment."
  }'
Create comment response example
{
  "success": true,
  "commentId": "urn:li:comment:(urn:li:activity:7503693773307224065,7507031919084109824)"
}
Reply to a comment
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "linkedin",
    "accountId": "your-li-id",
    "commentId": "urn:li:comment:(urn:li:activity:7503693773307224065,7506340885752803328)",
    "text": "An example comment."
  }'
Delete a comment
curl -X DELETE "{{API_BASE_URL}}/v1/comments/urn:li:comment:(urn:li:activity:7503693773307224065,7506340885752803328)?platform=linkedin&accountId=your-li-id" \
  -H "x-access-key: YOUR_API_KEY"
Delete comment response example
{
  "success": true
}