Post Comments
curl --request POST \
--url https://api.datamagnet.co/api/v1/post/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"page": 123
}
'import requests
url = "https://api.datamagnet.co/api/v1/post/comments"
payload = {
"url": "<string>",
"page": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', page: 123})
};
fetch('https://api.datamagnet.co/api/v1/post/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datamagnet.co/api/v1/post/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'page' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datamagnet.co/api/v1/post/comments"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"page\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datamagnet.co/api/v1/post/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"page\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datamagnet.co/api/v1/post/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"page\": 123\n}"
response = http.request(request)
puts response.read_body{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/apify/posts",
"subtitle": "22,134 followers",
"title": "Apify"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321434896030183426%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321434896030183426%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Awesome work Pratik Dani ❤️ ",
"timestamp": 1745566104897,
"top_replies": []
},
{
"commenter": {
"image": "https://media.licdn.com/dms/image/v2/D5603AQGBD4qUbB0j0A/profile-displayphoto-crop_800_800/B56ZhbUiPVHMAI-/0/1753878768080?e=1773273600&v=beta&t=92JTYvAs8ZBUhsC2K5eJ0P3NzfB8ND8EM-iTajxtvUk",
"navigation_url": "https://www.linkedin.com/in/anushka-tripathi-33631a21a",
"subtitle": "M.A. Public Policy",
"title": "Anushka Tripathi"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321422705793118208%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321422705793118208%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reactionTypeCounts": [],
"repliesCount": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"topReplies": []
}
],
"total": 2
}
}
Post Comments
Retrieve all comments on a LinkedIn post by URL, including commenter profiles, comment text, timestamps, and reply threads for engagement analysis.
POST
/
api
/
v1
/
post
/
comments
Post Comments
curl --request POST \
--url https://api.datamagnet.co/api/v1/post/comments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>",
"page": 123
}
'import requests
url = "https://api.datamagnet.co/api/v1/post/comments"
payload = {
"url": "<string>",
"page": 123
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: '<string>', page: 123})
};
fetch('https://api.datamagnet.co/api/v1/post/comments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.datamagnet.co/api/v1/post/comments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => '<string>',
'page' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.datamagnet.co/api/v1/post/comments"
payload := strings.NewReader("{\n \"url\": \"<string>\",\n \"page\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.datamagnet.co/api/v1/post/comments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"<string>\",\n \"page\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.datamagnet.co/api/v1/post/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"<string>\",\n \"page\": 123\n}"
response = http.request(request)
puts response.read_body{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/apify/posts",
"subtitle": "22,134 followers",
"title": "Apify"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321434896030183426%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321434896030183426%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Awesome work Pratik Dani ❤️ ",
"timestamp": 1745566104897,
"top_replies": []
},
{
"commenter": {
"image": "https://media.licdn.com/dms/image/v2/D5603AQGBD4qUbB0j0A/profile-displayphoto-crop_800_800/B56ZhbUiPVHMAI-/0/1753878768080?e=1773273600&v=beta&t=92JTYvAs8ZBUhsC2K5eJ0P3NzfB8ND8EM-iTajxtvUk",
"navigation_url": "https://www.linkedin.com/in/anushka-tripathi-33631a21a",
"subtitle": "M.A. Public Policy",
"title": "Anushka Tripathi"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321422705793118208%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321422705793118208%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reactionTypeCounts": [],
"repliesCount": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"topReplies": []
}
],
"total": 2
}
}
Post Comments
Cost:10 credits / successful request.
This endpoint retrieves comments from a LinkedIn post. Simply provide the LinkedIn post URL and the API will extract the activity ID automatically and return paginated comments.
Post comments endpoint
This endpoint allows you to get comments from any LinkedIn post by providing its URL.Required attributes
string
required
The LinkedIn post URL. Supports multiple URL formats:
https://www.linkedin.com/posts/username_slug-activity-7430615551086850048-XXXXhttps://www.linkedin.com/posts/username_slug-ugcPost-7430527985071595520-XXXXhttps://www.linkedin.com/feed/update/urn:li:activity:7430615551086850048
Optional attributes
integer
default:"1"
Page number for pagination. Use the
cursor value from the previous response to get the next page.Response
{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/apify/posts",
"subtitle": "22,134 followers",
"title": "Apify"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321434896030183426%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321434896030183426%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Awesome work Pratik Dani ❤️ ",
"timestamp": 1745566104897,
"top_replies": []
},
{
"commenter": {
"image": "https://media.licdn.com/dms/image/v2/D5603AQGBD4qUbB0j0A/profile-displayphoto-crop_800_800/B56ZhbUiPVHMAI-/0/1753878768080?e=1773273600&v=beta&t=92JTYvAs8ZBUhsC2K5eJ0P3NzfB8ND8EM-iTajxtvUk",
"navigation_url": "https://www.linkedin.com/in/anushka-tripathi-33631a21a",
"subtitle": "M.A. Public Policy",
"title": "Anushka Tripathi"
},
"edited": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:activity:7321383686006882304?commentUrn=urn%3Ali%3Acomment%3A%28activity%3A7321383686006882304%2C7321422705793118208%29&dashCommentUrn=urn%3Ali%3Afsd_comment%3A%287321422705793118208%2Curn%3Ali%3Aactivity%3A7321383686006882304%29",
"pinned": false,
"reactionTypeCounts": [],
"repliesCount": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"topReplies": []
}
],
"total": 2
}
}
The post comments model
Properties
integer | null
The next page number for pagination. Pass this value as the
page parameter in your next request. Returns null when there are no more pages.object
The response payload containing comments.
Show Message object
Show Message object
integer
Total number of comments available on the post.
array
List of comment objects.
Show Comment object
Show Comment object
string
The comment text content.
string
Direct permalink to the comment on LinkedIn.
number
Unix timestamp (milliseconds) when the comment was posted.
boolean
Whether the comment is pinned by the post author.
boolean
Whether the comment has been edited.
integer
Number of replies to this comment.
Commenter
object
Engagement
array
array
Top replies to the comment (if any).
Pagination
To paginate through all comments:- Make an initial request without the
pageparameter (defaults to page 1). - Check the
cursorfield in the response. - If
cursoris notnull, make another request withpageset to thecursorvalue. - Repeat until
cursorreturnsnull.
Example
import requests
url = "https://api.datamagnet.co/api/v1/post/comments"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
page = 1
all_comments = []
while page is not None:
response = requests.post(url, json={
"url": "https://www.linkedin.com/posts/username_slug-activity-7430615551086850048-XXXX",
"page": page
}, headers=headers)
data = response.json()
all_comments.extend(data["message"]["comments"])
page = data.get("cursor")
print(f"Total comments fetched: {len(all_comments)}")
Was this page helpful?
⌘I