Get comments from a post
Retrieve comments from a LinkedIn post with pagination support. Useful for analyzing engagement, finding leads who commented, or monitoring discussions. Returns comment content, author info, timestamps, and like counts.
/posts/commentsCode Examples
curl -X POST 'https://api.connectsafely.ai/linkedin/posts/comments' \ -H 'Authorization: Bearer <your_api_key>' \ -H 'Content-Type: application/json' \ -d '{"postUrl":"https://linkedin.com/posts/example-post"}'Parameters
No parameters.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
accountId | string | No | LinkedIn account ID to use. If not provided, uses the default account. |
postUrl | string | Yes | Full URL of the LinkedIn post to get comments from |
commentCount | number | No | Number of comments per page (enables pagination mode) |
start | number | No | Pagination offset (0-indexed) |
paginationToken | string | No | Token from previous response to fetch next page |
maxComments | number | No | Maximum total comments to retrieve |
batchSize | number | No | Internal batch size for fetching |
Example
{
"postUrl": "https://linkedin.com/posts/example-post"
}Responses
| Status | Description |
|---|---|
| 200 | Comments retrieved successfully |
| 400 | Bad request - Missing required fields |
| 401 | Unauthorized - Invalid or missing API key |
200 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
postUrl | string | URL of the post |
accountId | string | LinkedIn account ID used for the request |
comments | array | |
pagination | object | |
postDetails | object |
200 Example
{
"success": true,
"postUrl": "https://www.linkedin.com/feed/update/urn:li:activity:7431898703118110720",
"accountId": "696ce9e780e0483585e4e553",
"comments": [
{
"commentId": "urn:li:fsd_comment:(7431913248658059265,urn:li:ugcPost:7431898701888966656)",
"authorName": "John Doe",
"commentText": "Great insights! Thanks for sharing.",
"authorDesignation": "Software Engineer at Tech Company",
"commenterProfileId": "ACoAAAkEZoAB2YcQrbVMuMkEvlMH8zSEC5ESxec",
"publicIdentifier": "john-doe-123",
"profileUrl": "https://www.linkedin.com/in/john-doe-123",
"authorProfilePicture": "https://media.licdn.com/dms/image/...",
"createdAt": 1771906196752,
"likeCount": 5,
"replyCount": 2,
"hasProfile": true,
"commenterUrn": "urn:li:fsd_profile:ACoAAAkEZoAB2YcQrbVMuMkEvlMH8zSEC5ESxec"
}
],
"pagination": {
"start": 0,
"count": 5,
"total": 10,
"hasNextPage": true,
"nextPaginationToken": "abc123",
"nextStart": 5
},
"postDetails": {
"activityUrn": "urn:li:activity:7431898703118110720",
"ugcPostUrn": "urn:li:ugcPost:7431898701888966656",
"shareUrn": null,
"featuredActivityUrn": null,
"content": "Post content here..."
}
}400 Response Parameters
| Name | Type | Description |
|---|---|---|
success | boolean | |
error | object |
400 Example
{
"success": false,
"error": {
"issues": [
{
"code": "invalid_type",
"expected": "string",
"received": "undefined",
"path": [
"postUrl"
],
"message": "Required"
}
],
"name": "ZodError"
}
}401 Response Parameters
| Name | Type | Description |
|---|---|---|
error | string |
401 Example
{
"error": "Unauthorized - Invalid credentials"
}Repost a LinkedIn post
Repost/share a LinkedIn post to your feed. This creates an instant repost without additional commentary. Requires either a post URL (will be scraped for URNs) or the share/ugcPost URN directly. The activityUrn is optional but helps with engagement tracking.
Get all comments from a post
Fetch all comments from a LinkedIn post in a single request. Automatically handles pagination internally. Ideal for bulk analysis of post engagement. Use for posts with many comments where you need complete data.
