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.
| Field | Used in | Required in source examples | Meaning |
|---|---|---|---|
| platform | List, create, reply, delete | Yes, value linkedin | Identifies LinkedIn as the target platform. |
| accountId | List, create, reply, delete | Yes | Connected account id from the integrations response; determines member versus company Page actor. |
| postId | List, top-level create | Yes for those calls | Share URN of the target post; when listing replies, a comment URN is passed as postId. |
| commentId | Reply, delete | Yes for those calls | Composite comment URN returned by list or create; used as the reply target or in the delete path. |
| text | Top-level create, reply | Yes | Body text of the new comment or reply. |
| limit | List | Optional, default 25, range 1 to 100 | Page size for listed comments. |
| nextCursor | List response | Response field, may be null | Pagination cursor returned with the comments array. |
| x-access-key | All calls (header) | Yes | Access key header authenticating every request. |
Requiredness is stated exactly as shown in the source examples; no additional fields are invented.
| Operation | Method and path | Target field | Response |
|---|---|---|---|
| List comments on a post | GET /v1/comments | postId (share URN, or comment URN for replies) | success, comments array, nextCursor |
| Post a top-level comment | POST /v1/comments | postId (share URN) | success, commentId |
| Reply to a comment | POST /v1/comments | commentId (composite comment URN) | success, commentId |
| Delete a comment | DELETE /v1/comments/{commentId} | commentId in path, plus platform and accountId query params | success |
Decision table comparing the three write/read operations in the source contract.
| Field | Type in source example | Notes |
|---|---|---|
| id | string (composite URN) | Comment identifier; pass as commentId for reply or delete. |
| text | string | Comment body text. |
| author.id | string (URN) | Author identifier, for example urn:li:person:ZSAPHe3Z55. |
| author.name | string or null | Author name; null in the source example. |
| timestamp | string (ISO 8601) | Comment timestamp, for example 2026-08-05T14:22:10Z. |
| likeCount | number | Like count on the comment. |
| hidden | null for LinkedIn | No hidden state is reported for LinkedIn; there is no hide/unhide action. |
| replies | array | Nested replies; empty array in the source example. |
| nextCursor | string or null | Pagination cursor; null when no further page is indicated in the example. |
| commentId | string (composite URN) | Returned by create and reply calls for the new comment. |
Field map derived from the source list and create response examples.
| Failure or limitation | What you observe | Check or fix |
|---|---|---|
| 403 permission error on comment calls | API says you lack permission | Comment 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 scopes | Posting works but comments fail | Reconnect the LinkedIn account once so its token includes the comment scopes. |
| Incorrect URN encoding | API rejects the path or target | Use the full composite URN exactly as returned in id or commentId; do not rebuild or partially encode it. |
| hidden is null | No true/false hidden state | Expected for LinkedIn: there is no hide/unhide action, so moderate with reply and delete only. |
| Wrong target field | Reply lands as a top-level comment or vice versa | Use 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.
curl {{API_BASE_URL}}/v1/connect/linkedin \
-H "x-access-key: YOUR_API_KEY"curl {{API_BASE_URL}}/v1/connect/integrations \
-H "x-access-key: YOUR_API_KEY"curl "{{API_BASE_URL}}/v1/comments?platform=linkedin&accountId=your-li-id&postId=urn:li:share:7503693751647723520" \
-H "x-access-key: YOUR_API_KEY"{
"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
}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"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."
}'{
"success": true,
"commentId": "urn:li:comment:(urn:li:activity:7503693773307224065,7507031919084109824)"
}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."
}'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"{
"success": true
}