curl --request GET \
--url https://api.fetchin.io/api/v1/post/comments \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.fetchin.io/api/v1/post/comments"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.fetchin.io/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.fetchin.io/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 => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fetchin.io/api/v1/post/comments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.fetchin.io/api/v1/post/comments")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetchin.io/api/v1/post/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"comments": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287957733851484162)",
"text": "Great post! Thanks for sharing.",
"createdAt": "2024-01-22T14:22:07.458Z",
"reactionCount": 5,
"reactionTypeCounts": [
{ "type": "LIKE", "count": 4 },
{ "type": "PRAISE", "count": 1 }
],
"replyCount": 1,
"edited": false,
"pinned": false,
"authorIsPostAuthor": false,
"contributed": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7287782484287606784?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7287782484287606784%2C7287957733851484162%29",
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAABCDEFG",
"name": "Jane Doe",
"headline": "Software Engineer at Tech Company",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/janedoe",
"profileId": "ACoAABCDEFG",
"publicId": "janedoe",
"memberId": "48211934"
},
"replies": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287960123456789012)",
"text": "Totally agree with you!",
"createdAt": "2024-01-22T14:35:00.000Z",
"reactionCount": 2,
"edited": false,
"authorIsPostAuthor": true,
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAAHIJKLM",
"name": "John Smith",
"headline": "Product Manager",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/johnsmith",
"profileId": "ACoAAHIJKLM",
"publicId": "johnsmith",
"memberId": "11930457"
},
"replies": []
}
]
},
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287958844962595073)",
"text": "We see the same thing with our customers.",
"createdAt": "2024-01-22T14:25:30.000Z",
"reactionCount": 3,
"edited": true,
"pinned": false,
"authorIsPostAuthor": false,
"author": {
"type": "company",
"id": "urn:li:fsd_company:4999584",
"name": "Doctolib",
"headline": "323,490 followers",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/company/doctolib/",
"companyId": "4999584",
"universalName": "doctolib"
},
"replies": []
}
],
"total": 42,
"paginationToken": "MTAtMTcwNjAwMDAwMDAwMA==",
"hasMore": true
}
{
"error": "Missing postUrlOrUrn parameter",
"code": "MISSING_PARAMETER"
}
{
"error": "'sortBy' must be one of: relevance, recent (received 'newest').",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Unable to find post from url",
"code": "POST_NOT_FOUND"
}
{
"error": "Quota exceeded. Upgrade your plan or wait for renewal.",
"code": "QUOTA_EXHAUSTED",
"details": {
"creditsRemaining": 0,
"subscriptionCreditsRemaining": 0,
"paygCreditsRemaining": 0,
"buyCreditsUrl": "https://fetchin.io/credits"
}
}
{
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Get Post Comments
Fetch comments from a professional post with author information and replies
curl --request GET \
--url https://api.fetchin.io/api/v1/post/comments \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.fetchin.io/api/v1/post/comments"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.fetchin.io/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.fetchin.io/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 => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.fetchin.io/api/v1/post/comments"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.fetchin.io/api/v1/post/comments")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fetchin.io/api/v1/post/comments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"comments": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287957733851484162)",
"text": "Great post! Thanks for sharing.",
"createdAt": "2024-01-22T14:22:07.458Z",
"reactionCount": 5,
"reactionTypeCounts": [
{ "type": "LIKE", "count": 4 },
{ "type": "PRAISE", "count": 1 }
],
"replyCount": 1,
"edited": false,
"pinned": false,
"authorIsPostAuthor": false,
"contributed": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7287782484287606784?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7287782484287606784%2C7287957733851484162%29",
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAABCDEFG",
"name": "Jane Doe",
"headline": "Software Engineer at Tech Company",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/janedoe",
"profileId": "ACoAABCDEFG",
"publicId": "janedoe",
"memberId": "48211934"
},
"replies": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287960123456789012)",
"text": "Totally agree with you!",
"createdAt": "2024-01-22T14:35:00.000Z",
"reactionCount": 2,
"edited": false,
"authorIsPostAuthor": true,
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAAHIJKLM",
"name": "John Smith",
"headline": "Product Manager",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/johnsmith",
"profileId": "ACoAAHIJKLM",
"publicId": "johnsmith",
"memberId": "11930457"
},
"replies": []
}
]
},
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287958844962595073)",
"text": "We see the same thing with our customers.",
"createdAt": "2024-01-22T14:25:30.000Z",
"reactionCount": 3,
"edited": true,
"pinned": false,
"authorIsPostAuthor": false,
"author": {
"type": "company",
"id": "urn:li:fsd_company:4999584",
"name": "Doctolib",
"headline": "323,490 followers",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/company/doctolib/",
"companyId": "4999584",
"universalName": "doctolib"
},
"replies": []
}
],
"total": 42,
"paginationToken": "MTAtMTcwNjAwMDAwMDAwMA==",
"hasMore": true
}
{
"error": "Missing postUrlOrUrn parameter",
"code": "MISSING_PARAMETER"
}
{
"error": "'sortBy' must be one of: relevance, recent (received 'newest').",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Unable to find post from url",
"code": "POST_NOT_FOUND"
}
{
"error": "Quota exceeded. Upgrade your plan or wait for renewal.",
"code": "QUOTA_EXHAUSTED",
"details": {
"creditsRemaining": 0,
"subscriptionCreditsRemaining": 0,
"paygCreditsRemaining": 0,
"buyCreditsUrl": "https://fetchin.io/credits"
}
}
{
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Endpoint
GET /api/v1/post/comments
Authentication
Include your API key in the request header:X-API-Key: your-api-key-here
Parameters
https://www.linkedin.com/posts/username_some-post-slug-1234567890-abcdurn:li:activity:7287782484287606784urn:li:ugcPost:7287782484287606784urn:li:groupPost:4521873-7287782484287606784— a post published in a group, asurn:li:groupPost:<groupId>-<postId>or any URL containing it. A post in a private group is visible to the group’s members only and answers404 POST_NOT_FOUND, like a deleted post.
sortBy order.relevance(default) — the source’s own ranking. It returns a ranked subset of the thread, not all of it: measured, 224 of 299 top-level comments on one post.recent— newest first. It returns the complete thread in date order, and is the way to walk every comment or to pick up new ones since your last read.
400 that costs nothing
('sortBy' must be one of: relevance, recent (received '…').).- Minimum: 1
- Maximum: 100
- Default: 100
start by the number of comments you received.- Default: 0
start.Response
sortBy, each
with its replies nested.Show Comment object
Show Comment object
type / count pairs in the source’s
order (LIKE, PRAISE, …), when the source provides them.true when the comment was edited after it was posted.true when the comment is pinned to the top of the thread.true when the comment was written by the post’s own author.true when the comment is a contribution to a collaborative article.type.Show Author object
Show Author object
profile for a member, company for a company page.urn:li:fsd_profile:<profileId> for a member,
urn:li:fsd_company:<companyId> for a company page."1,207 followers")./posts suffix)ACoAA…), the same value as profileId in
Fetch Profile./in/<publicId>)./company/<universalName>).false on an empty
page.Example Request
curl -X GET "https://api.fetchin.io/api/v1/post/comments?postUrlOrUrn=urn:li:ugcPost:7287782484287606784&count=10" \
-H "X-API-Key: your-api-key-here"
const response = await fetch(
'https://api.fetchin.io/api/v1/post/comments?postUrlOrUrn=urn:li:ugcPost:7287782484287606784&count=10',
{
headers: {
'X-API-Key': 'your-api-key-here'
}
}
);
const data = await response.json();
console.log(data);
import requests
headers = {
'X-API-Key': 'your-api-key-here'
}
params = {
'postUrlOrUrn': 'urn:li:ugcPost:7287782484287606784',
'count': 10
}
response = requests.get(
'https://api.fetchin.io/api/v1/post/comments',
headers=headers,
params=params
)
data = response.json()
print(data)
<?php
$apiKey = 'your-api-key-here';
$postUrlOrUrn = 'urn:li:ugcPost:7287782484287606784';
$count = 10;
$url = "https://api.fetchin.io/api/v1/post/comments?postUrlOrUrn=" . urlencode($postUrlOrUrn) . "&count=" . $count;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'X-API-Key: ' . $apiKey
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
print_r($data);
?>
Example Response
{
"comments": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287957733851484162)",
"text": "Great post! Thanks for sharing.",
"createdAt": "2024-01-22T14:22:07.458Z",
"reactionCount": 5,
"reactionTypeCounts": [
{ "type": "LIKE", "count": 4 },
{ "type": "PRAISE", "count": 1 }
],
"replyCount": 1,
"edited": false,
"pinned": false,
"authorIsPostAuthor": false,
"contributed": false,
"permalink": "https://www.linkedin.com/feed/update/urn:li:ugcPost:7287782484287606784?commentUrn=urn%3Ali%3Acomment%3A%28ugcPost%3A7287782484287606784%2C7287957733851484162%29",
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAABCDEFG",
"name": "Jane Doe",
"headline": "Software Engineer at Tech Company",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/janedoe",
"profileId": "ACoAABCDEFG",
"publicId": "janedoe",
"memberId": "48211934"
},
"replies": [
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287960123456789012)",
"text": "Totally agree with you!",
"createdAt": "2024-01-22T14:35:00.000Z",
"reactionCount": 2,
"edited": false,
"authorIsPostAuthor": true,
"author": {
"type": "profile",
"id": "urn:li:fsd_profile:ACoAAHIJKLM",
"name": "John Smith",
"headline": "Product Manager",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/in/johnsmith",
"profileId": "ACoAAHIJKLM",
"publicId": "johnsmith",
"memberId": "11930457"
},
"replies": []
}
]
},
{
"urn": "urn:li:comment:(ugcPost:7287782484287606784,7287958844962595073)",
"text": "We see the same thing with our customers.",
"createdAt": "2024-01-22T14:25:30.000Z",
"reactionCount": 3,
"edited": true,
"pinned": false,
"authorIsPostAuthor": false,
"author": {
"type": "company",
"id": "urn:li:fsd_company:4999584",
"name": "Doctolib",
"headline": "323,490 followers",
"profilePictureUrl": "https://media.licdn.com/dms/image/...",
"profileUrl": "https://www.linkedin.com/company/doctolib/",
"companyId": "4999584",
"universalName": "doctolib"
},
"replies": []
}
],
"total": 42,
"paginationToken": "MTAtMTcwNjAwMDAwMDAwMA==",
"hasMore": true
}
{
"error": "Missing postUrlOrUrn parameter",
"code": "MISSING_PARAMETER"
}
{
"error": "'sortBy' must be one of: relevance, recent (received 'newest').",
"code": "INVALID_PARAMETER"
}
{
"error": "Invalid API key",
"code": "INVALID_API_KEY"
}
{
"error": "Unable to find post from url",
"code": "POST_NOT_FOUND"
}
{
"error": "Quota exceeded. Upgrade your plan or wait for renewal.",
"code": "QUOTA_EXHAUSTED",
"details": {
"creditsRemaining": 0,
"subscriptionCreditsRemaining": 0,
"paygCreditsRemaining": 0,
"buyCreditsUrl": "https://fetchin.io/credits"
}
}
{
"error": "Internal server error",
"code": "INTERNAL_ERROR"
}
{
"error": "Service temporarily unable to serve this request. Please retry.",
"code": "SERVICE_UNAVAILABLE"
}
Errors
See Error Handling for the full list of error codes and recommended handling.400—MISSING_PARAMETER/INVALID_PARAMETER(e.g. an unknownsortBy, free) /INVALID_URN401—INVALID_API_KEY404—POST_NOT_FOUND402—QUOTA_EXHAUSTED429—RATE_LIMITED500—INTERNAL_ERROR503—SERVICE_UNAVAILABLE
Pagination
This endpoint pages by offset:- Make an initial request with
start=0 - If
hasMoreistrue, add the number of comments you received tostart - Continue until
hasMoreisfalseor a page comes back empty
count and still not be the last one — the first
page of a busy thread often returns a handful of comments while hundreds remain.
Trust hasMore, not the number of items returned. An empty page always has
hasMore: false.
sortBy=recent. Under the default relevance
the source serves a ranked subset of the thread, so a full walk ends early —
measured, 224 of 299 top-level comments. recent returns the complete thread,
newest first, in a stable order, which also makes it the way to pick up new
comments since your last read: stop as soon as you reach a comment you already
have. Compare what you collected against total to check a walk.async function fetchAllComments(postUrlOrUrn) {
const allComments = [];
let start = 0;
let hasMore = true;
while (hasMore) {
const params = new URLSearchParams({
postUrlOrUrn,
sortBy: 'recent',
count: '100',
start: String(start),
});
const response = await fetch(
`https://api.fetchin.io/api/v1/post/comments?${params}`,
{ headers: { 'X-API-Key': 'your-api-key-here' } }
);
const data = await response.json();
if (data.comments.length === 0) break;
allComments.push(...data.comments);
start += data.comments.length;
hasMore = data.hasMore;
}
return allComments;
}
Notes
count parameter value. Errors are free — with one exception: a 404 not found costs 1 credit. See Quotas.sortBy —
relevance by default, newest first with sortBy=recent. Each comment includes
its replies (subcomments) nested within, and total counts top-level comments
only.start, not paginationToken. To keep a thread up to date, poll it
with sortBy=recent and stop at the first comment you already have.Authorizations
Query Parameters
Professional post URL or URN: urn:li:activity:<id>, urn:li:ugcPost:<id>, a group post as urn:li:groupPost:<groupId>-<postId>, or any post URL containing one. A repost without commentary answers with the original post's comments.
"https://www.linkedin.com/posts/username_post-slug-1234567890-abcd"
Order of the comments. relevance (default) is the source's own ranking and returns a ranked SUBSET of the thread (measured: 224 of 299 top-level comments). recent returns the COMPLETE thread, newest first: use it to walk every comment or to pick up new ones. Any other value is a 400 that costs nothing.
relevance, recent Number of comments to fetch (default: 100)
1 <= x <= 100Offset of the first item to return. This endpoint pages by offset: advance start by the number of items you received. Keep requesting while hasMore is true; an empty page ends the list.
x >= 0Returned for continuity with the other endpoints. It does not advance this thread - page with start.
Response
Successfully fetched comments
Top-level comments in the source's order for sortBy, each with its replies nested.
Show child attributes
Show child attributes
Number of top-level comments the source reports for the post (replies not included). Omitted when the source does not report one.
42
Token for fetching the next page
Whether more comments are available. Always false on an empty page.