Comments And Reactions
A post's comments, replies and reactions; commenting, reacting, and Direct's routes to delete a comment or remove a reaction.
{post_id} takes the post's id (digits), urn:li:activity:…, urn:li:ugcPost:…, urn:li:share:… or its URL (URL-encoded). A comment's id is digits, as GET /posts/{post_id}/comments answers it.
List Comments#
curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments?account_id=$ACCOUNT_ID&sort_by=MOST_RECENT" \
-H "X-API-KEY: $DIRECT_API_KEY"{
"object": "CommentList",
"items": [
{
"object": "Comment",
"id": "7390000000000000001",
"post_id": "7388000000000000000",
"post_urn": "urn:li:activity:7388000000000000000",
"author": "Bob Buyer",
"author_details": {
"id": "ACoAAAzyxwvutsrqponml",
"headline": "Founder",
"profile_url": "https://www.linkedin.com/in/bob-buyer",
"profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg",
"network_distance": "DISTANCE_2",
"is_company": false
},
"date": "2025-10-24T10:00:00.000Z",
"text": "Great point",
"reaction_counter": 4,
"reply_counter": 1
}
],
"cursor": "<cursor>",
"total_items": 5,
"paging": { "start": 0, "page_count": 1, "total_count": 5 }
}limit: 1 to 100 (default 10).sort_by:MOST_RELEVANT(the default) orMOST_RECENT(newest first).comment_id: that comment's replies instead, oldest first as LinkedIn's apps show them (newest first withMOST_RECENT; LinkedIn has no relevance order for replies).user_reactedholds the account's own reaction to a comment, when it reacted. A page's comment hasis_company: trueinauthor_details.- As Unipile's: the author's name is
author(author_detailshas no name or public identifier), andnetwork_distanceis LinkedIn's own word for the account itself and its 1st and 2nd degree (SELF,DISTANCE_1,DISTANCE_2),DISTANCE_3for anyone further, out of network, or a page. - A reply (with
comment_id) hasthread_id: its parent comment's id. Its list hastotal_items: nullandpaging.total_count: null, as Unipile's. Direct finds the post's comment thread by itself (most company and recent posts keep their comments under theirugcPost, others under theiractivity).
Comment Or Reply#
curl -sS -X POST "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments" \
-H "X-API-KEY: $DIRECT_API_KEY" \
-H "Idempotency-Key: comment-7388-1" \
-H "Content-Type: application/json" \
-d '{ "account_id": "'"$ACCOUNT_ID"'", "text": "Agreed, the second point is the one people miss." }'{ "object": "CommentSent", "comment_id": "7390000000000000009" }Status 201.
| Field | |
|---|---|
account_id |
The account that comments (or ?account_id=). |
text |
1,250 characters at most, mentions' names and an added link included. |
comment_id |
Reply to this comment. |
mentions |
As on posts: [{name, profile_id, is_company?}], placed with {{0}}… |
external_link |
An http(s) link, added at the end of the text unless it's in it. |
as_organization |
Comment as this company page (its id, digits). |
attachments |
One image (jpg, png, gif or webp), multipart. |
comment_id in the answer is empty when LinkedIn didn't name the new comment.
Delete A Comment#
Direct's own route: Unipile has none.
curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/comments/7390000000000000009?account_id=$ACCOUNT_ID" \
-H "X-API-KEY: $DIRECT_API_KEY"{ "object": "CommentDeleted" }List Reactions#
curl -sS "https://direct.lempile.com/api/v1/posts/urn:li:activity:7388000000000000000/reactions?account_id=$ACCOUNT_ID" \
-H "X-API-KEY: $DIRECT_API_KEY"{
"object": "PostReactionList",
"items": [
{
"object": "PostReaction",
"value": "PRAISE",
"post_id": "7388000000000000000",
"author": {
"id": "ACoAAAzyxwvutsrqponml",
"type": "INDIVIDUAL",
"name": "Bob Buyer",
"headline": "Head of Sales",
"profile_url": "https://www.linkedin.com/in/bob-buyer/",
"profile_picture_url": "https://media.licdn.com/dms/image/x/400.jpg",
"public_identifier": "bob-buyer",
"network_distance": "SECOND_DEGREE"
}
}
],
"cursor": null,
"paging": { "cursor": null, "start": 0, "page_count": 1, "total_count": 1 }
}limit: 1 to 100 (default 10).comment_id: a comment's reactions instead (each item then hascomment_id).valueis LinkedIn's name:LIKE,PRAISE,APPRECIATION,EMPATHY,INTEREST,ENTERTAINMENT. A page's reaction hastype: "COMPANY".
React#
curl -sS -X POST "https://direct.lempile.com/api/v1/posts/reaction" \
-H "X-API-KEY: $DIRECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"account_id": "'"$ACCOUNT_ID"'",
"post_id": "urn:li:activity:7388000000000000000",
"reaction_type": "like"
}'{ "object": "ReactionAdded" }Status 201.
reaction_type (Unipile's) |
LinkedIn's |
|---|---|
like (default) |
LIKE |
celebrate |
PRAISE |
support |
APPRECIATION |
love |
EMPATHY |
insightful |
INTEREST |
funny |
ENTERTAINMENT |
comment_id reacts to one of the post's comments; as_organization reacts as a company page.
Remove A Reaction#
Direct's own route: Unipile has none. The same fields as reacting, in the query or a JSON body:
curl -sS -X DELETE "https://direct.lempile.com/api/v1/posts/reaction?account_id=$ACCOUNT_ID&post_id=urn%3Ali%3Aactivity%3A7388000000000000000" \
-H "X-API-KEY: $DIRECT_API_KEY"{ "object": "ReactionRemoved" }Every write here takes ?dry_run=true and an Idempotency-Key.
Was this page helpful?