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,
"sort": "<string>"
}
'import requests
url = "https://api.datamagnet.co/api/v1/post/comments"
payload = {
"url": "<string>",
"page": 123,
"sort": "<string>"
}
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, sort: '<string>'})
};
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,
'sort' => '<string>'
]),
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 \"sort\": \"<string>\"\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 \"sort\": \"<string>\"\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 \"sort\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/example-co/posts",
"subtitle": "22,134 followers",
"title": "Example Co"
},
"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",
"sales_nav_id": "ACoAADbZ2yIBx1dPq0aN7v8EXAMPLEidY4mVt0",
"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,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"times": "2025-04-25T06:39:58.517Z",
"top_replies": []
}
],
"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,
"sort": "<string>"
}
'import requests
url = "https://api.datamagnet.co/api/v1/post/comments"
payload = {
"url": "<string>",
"page": 123,
"sort": "<string>"
}
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, sort: '<string>'})
};
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,
'sort' => '<string>'
]),
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 \"sort\": \"<string>\"\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 \"sort\": \"<string>\"\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 \"sort\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/example-co/posts",
"subtitle": "22,134 followers",
"title": "Example Co"
},
"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",
"sales_nav_id": "ACoAADbZ2yIBx1dPq0aN7v8EXAMPLEidY4mVt0",
"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,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"times": "2025-04-25T06:39:58.517Z",
"top_replies": []
}
],
"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. You can send it as page or as cursor; if you send both, page is used.string
Order of the comments:
"recent" (newest first) or "relevance". When omitted, comments are returned newest first. Any other value returns a 400.Response
{
"cursor": null,
"message": {
"comments": [
{
"commenter": {
"navigation_url": "https://www.linkedin.com/company/example-co/posts",
"subtitle": "22,134 followers",
"title": "Example Co"
},
"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",
"sales_nav_id": "ACoAADbZ2yIBx1dPq0aN7v8EXAMPLEidY4mVt0",
"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,
"reaction_type_counts": [],
"replies_count": 0,
"text": "Many congratulations 🎉",
"timestamp": 1745563198517,
"times": "2025-04-25T06:39:58.517Z",
"top_replies": []
}
],
"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
Number of top-level comments on the post. Replies are not counted here: they are returned nested inside each comment (
top_replies, counted by replies_count). The comment count LinkedIn shows on a post includes replies, so it is usually higher than total.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.
string
The same moment as
timestamp, as an ISO 8601 string (e.g. "2026-02-22T16:46:14.489Z").boolean
Whether the comment is pinned by the post author.
boolean
Whether the comment has been edited.
integer
Number of replies to this comment.
array
People and companies tagged in the comment. Empty when nobody is tagged. Replies in
top_replies carry the same array.Commenter
object
Details about who wrote the comment. Usually a member, but company and school pages comment too: check
navigation_url (/in/, /company/, /school/).Show Commenter object
Show Commenter object
string
Commenter’s name.
string
Commenter’s LinkedIn headline.
string
Commenter’s profile picture URL.
null or absent when the commenter has no picture.string
Link to the commenter’s LinkedIn profile or page.
string
The commenter’s LinkedIn member id (
ACoA…), the id in urn:li:fsd_profile:<id>. Absent for company and school pages.Engagement
array
array
Replies to the comment (if any), in the same shape as a comment.
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?