Skip to main content
GET
/
api
/
v1
/
post
/
comments
Get comments from a LinkedIn post
curl --request GET \
  --url https://api.fetchin.io/api/v1/post/comments \
  --header 'X-API-Key: <api-key>'
{
  "comments": [
    {
      "urn": "urn:li:comment:(ugcPost:7287782484287606784,7287957733851484162)",
      "text": "Great post! Thanks for sharing.",
      "createdAt": "2024-01-22T14:22:07.458Z",
      "reactionCount": 5,
      "author": {
        "name": "Jane Doe",
        "headline": "Software Engineer at Tech Company",
        "profilePictureUrl": "https://media.licdn.com/dms/image/...",
        "profileUrl": "https://www.linkedin.com/in/janedoe"
      },
      "replies": [
        {
          "urn": "urn:li:comment:(ugcPost:7287782484287606784,7287960123456789012)",
          "text": "Totally agree with you!",
          "createdAt": "2024-01-22T14:35:00.000Z",
          "reactionCount": 2,
          "author": {
            "name": "John Smith",
            "headline": "Product Manager",
            "profilePictureUrl": "https://media.licdn.com/dms/image/...",
            "profileUrl": "https://www.linkedin.com/in/johnsmith"
          },
          "replies": []
        }
      ]
    },
    {
      "urn": "urn:li:comment:(ugcPost:7287782484287606784,7287958844962595073)",
      "text": "Very insightful perspective!",
      "createdAt": "2024-01-22T14:25:30.000Z",
      "reactionCount": 3,
      "author": {
        "name": "Alice Johnson",
        "headline": "Marketing Director",
        "profilePictureUrl": "https://media.licdn.com/dms/image/...",
        "profileUrl": "https://www.linkedin.com/in/alicejohnson"
      },
      "replies": []
    }
  ],
  "paginationToken": "MTAtMTcwNjAwMDAwMDAwMA==",
  "hasMore": true
}

Endpoint

GET /api/v1/post/comments

Authentication

Include your API key in the request header:
X-API-Key: your-api-key-here

Parameters

postUrn
string
required
LinkedIn post URN.Examples:
  • urn:li:ugcPost:7287782484287606784
  • urn:li:activity:7287782484287606784
count
integer
default:"100"
Number of comments to fetch per page.
  • Minimum: 1
  • Maximum: 100
  • Default: 100
start
integer
default:"0"
Offset for pagination.
  • Default: 0
paginationToken
string
Token for fetching the next page of comments. Returned from previous request when more comments are available.

Response

comments
array
Array of LinkedIn comments
paginationToken
string
Token for fetching the next page of comments. Only present when more comments are available.
hasMore
boolean
Indicates whether there are more comments to fetch.

Example Request

curl -X GET "https://api.fetchin.io/api/v1/post/comments?postUrn=urn:li:ugcPost:7287782484287606784&count=10" \
  -H "X-API-Key: your-api-key-here"

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,
      "author": {
        "name": "Jane Doe",
        "headline": "Software Engineer at Tech Company",
        "profilePictureUrl": "https://media.licdn.com/dms/image/...",
        "profileUrl": "https://www.linkedin.com/in/janedoe"
      },
      "replies": [
        {
          "urn": "urn:li:comment:(ugcPost:7287782484287606784,7287960123456789012)",
          "text": "Totally agree with you!",
          "createdAt": "2024-01-22T14:35:00.000Z",
          "reactionCount": 2,
          "author": {
            "name": "John Smith",
            "headline": "Product Manager",
            "profilePictureUrl": "https://media.licdn.com/dms/image/...",
            "profileUrl": "https://www.linkedin.com/in/johnsmith"
          },
          "replies": []
        }
      ]
    },
    {
      "urn": "urn:li:comment:(ugcPost:7287782484287606784,7287958844962595073)",
      "text": "Very insightful perspective!",
      "createdAt": "2024-01-22T14:25:30.000Z",
      "reactionCount": 3,
      "author": {
        "name": "Alice Johnson",
        "headline": "Marketing Director",
        "profilePictureUrl": "https://media.licdn.com/dms/image/...",
        "profileUrl": "https://www.linkedin.com/in/alicejohnson"
      },
      "replies": []
    }
  ],
  "paginationToken": "MTAtMTcwNjAwMDAwMDAwMA==",
  "hasMore": true
}

Pagination

To fetch all comments from a post with many comments, use pagination:
  1. Make an initial request without paginationToken
  2. If hasMore is true, use the returned paginationToken in your next request
  3. Continue until hasMore is false
async function fetchAllComments(postUrn) {
  const allComments = [];
  let paginationToken = null;
  let hasMore = true;

  while (hasMore) {
    const params = new URLSearchParams({ postUrn, count: '100' });
    if (paginationToken) {
      params.set('paginationToken', paginationToken);
    }

    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();
    allComments.push(...data.comments);
    paginationToken = data.paginationToken;
    hasMore = data.hasMore;
  }

  return allComments;
}

Notes

This endpoint counts as 1 request toward your monthly quota per API call, regardless of the count parameter value.
Comments are returned in relevance order by default. Each comment includes its replies (subcomments) nested within.
Use the paginationToken to efficiently paginate through large comment sections without re-fetching already retrieved comments.

Authorizations

X-API-Key
string
header
required

Query Parameters

postUrn
string
required

LinkedIn post URN

Example:

"urn:li:ugcPost:7287782484287606784"

count
integer
default:100

Number of comments to fetch (default: 100)

Required range: 1 <= x <= 100
start
integer
default:0

Offset for pagination (default: 0)

Required range: x >= 0
paginationToken
string

Token for fetching the next page of comments

Response

Successfully fetched comments

comments
object[]
paginationToken
string

Token for fetching the next page

hasMore
boolean

Whether more comments are available